is00hcw / tungsten-replicator

Automatically exported from code.google.com/p/tungsten-replicator
0 stars 1 forks source link

how to re-execute the failed statement in slave occured due to deadlock transaction rollback by mysql in multi-master replication #765

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Use all_masters toplogy in tungsten-replicator
2. Now execute update statment for same in one master and update from another 
master. 
3.When both statement are apply at same time in third master then mysql 
encounter deadlock and rollback one transaction which is finally failed with 
error in tungsten replicator

What is the expected output?

The expected output should be that failed statement should be re-executed on 
failed slave which is auto handle in native replication by mysql with this 
variables slave_transaction_retry but there is no any handle in 
tungsten-replicator.(all_masters topolgy)

What do you see instead?

replication break with failed seqno on details it is found that this failed 
statement are deadlock victim statement by mysql. which should be re-executed.

What version of the product are you using?

version used: Tungsten Replicator 2.1.1 build 25

On what operating system?

CentOS 6.2

Original issue reported on code.google.com by mukeshpr...@gmail.com on 30 Nov 2013 at 3:01

GoogleCodeExporter commented 9 years ago
Please help me to resolve this deadlock issue

Original comment by mukeshpr...@gmail.com on 5 Dec 2013 at 5:29

GoogleCodeExporter commented 9 years ago
This is not a bug. There is no expectation that the slave re-executes a failed 
statement.
As of today, Tungsten does not have conflict resolution features. However you 
can avoid some conflicts by enforcing a System of Records 
(https://code.google.com/p/tungsten-replicator/wiki/Shard_Management_API)

Original comment by g.maxia on 5 Dec 2013 at 5:41

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for your help!!

I have a question to ask that is there any alternative of 
slave_transaction_retry variable [MySQL native slave variable] in tungsten 
replicator

Original comment by mukeshpr...@gmail.com on 6 Dec 2013 at 8:41

GoogleCodeExporter commented 9 years ago
Please send your questions to the discussion group. 
http://groups.google.com/group/tungsten-replicator-discuss

Original comment by g.maxia on 6 Dec 2013 at 8:51

GoogleCodeExporter commented 9 years ago
Here what I got in log: Topology: ALL_MASTERS and issue like : Deadlock found 
when trying to get lock; try restarting transaction

INFO   | jvm 1    | 2013/11/12 20:56:22 | 2013-11-12 20:56:22,083 [alpha - 
q-to-dbms-0] INFO  pipeline.SingleThreadStageTask Performing emergency rollback 
of applied changes
INFO   | jvm 1    | 2013/11/12 20:56:22 | 2013-11-12 20:56:22,083 [alpha - 
q-to-dbms-0] INFO  pipeline.SingleThreadStageTask Dispatching error event: 
Event application failed: seqno=306 fragno=0 message=java.sql.SQLException: 
Statement failed on slave but succeeded on master
INFO   | jvm 1    | 2013/11/12 20:56:22 | 2013-11-12 20:56:22,084 [alpha - 
pool-14-thread-1] ERROR management.OpenReplicatorManager Received error 
notification, shutting down services :
INFO   | jvm 1    | 2013/11/12 20:56:22 | Event application failed: seqno=306 
fragno=0 message=java.sql.SQLException: Statement failed on slave but succeeded 
on master
INFO   | jvm 1    | 2013/11/12 20:56:22 | INSERT INTO 
EMAIL_SHARED_QUERY_MATCH_RESULTS (VERSION, INSERT_TIME, UPDATE_TIME, QUERY_ID, 
SITE_DOC_ID, GROUP_ID, FLAG) VALUES (0,'2013-11-12 20:56:14','2013-11-12 
20:56:14',554563,646268838,427875775,0)
INFO   | jvm 1    | 2013/11/12 20:56:22 | 
com.continuent.tungsten.replicator.applier.ApplierException: 
java.sql.SQLException: Statement failed on slave but succeeded on master
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.applier.MySQLDrizzleApplier.applyStatementDat
a(MySQLDrizzleApplier.java:183)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.applier.JdbcApplier.apply(JdbcApplier.java:13
24)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.applier.ApplierWrapper.apply(ApplierWrapper.j
ava:101)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.pipeline.SingleThreadStageTask.apply(SingleTh
readStageTask.java:706)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.pipeline.SingleThreadStageTask.runTask(Single
ThreadStageTask.java:484)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.pipeline.SingleThreadStageTask.run(SingleThre
adStageTask.java:169)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
java.lang.Thread.run(Thread.java:701)
INFO   | jvm 1    | 2013/11/12 20:56:22 | Caused by: java.sql.SQLException: 
Statement failed on slave but succeeded on master
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.applier.MySQLDrizzleApplier.applyStatementDat
a(MySQLDrizzleApplier.java:140)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       ... 6 more
INFO   | jvm 1    | 2013/11/12 20:56:22 | Caused by: 
java.sql.SQLTransactionRollbackException: Deadlock found when trying to get 
lock; try restarting transaction
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
org.drizzle.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:101)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
org.drizzle.jdbc.DrizzleStatement.executeBatch(DrizzleStatement.java:957)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
com.continuent.tungsten.replicator.applier.MySQLDrizzleApplier.applyStatementDat
a(MySQLDrizzleApplier.java:126)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       ... 6 more
INFO   | jvm 1    | 2013/11/12 20:56:22 | Caused by: 
org.drizzle.jdbc.internal.common.QueryException: Deadlock found when trying to 
get lock; try restarting transaction
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
org.drizzle.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:46
5)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
org.drizzle.jdbc.internal.mysql.MySQLProtocol.executeBatch(MySQLProtocol.java:50
3)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       at 
org.drizzle.jdbc.DrizzleStatement.executeBatch(DrizzleStatement.java:944)
INFO   | jvm 1    | 2013/11/12 20:56:22 |       ... 7 more

Original comment by mukeshpr...@gmail.com on 5 Feb 2014 at 5:17