-
Hello, First, thank you for the library, it has been very useful to me :) My question is in regards to deadlocks. In the case there is a deadlock, and mysql server decides that this connection loses, what does this look like to the application? (ie: is an exception supposed to be thrown? It doesn't seem to be for me, but I could be doing something wrong). Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Yes, for an XA transaction, you'll get an exception similar to the following:
For a regular transaction, you'll get an exception similar to:
|
Beta Was this translation helpful? Give feedback.
-
@bgrainger in my application, logging shows I want to catch this situation and retry reexecute the sql or just ignore Is there any example to instruct catch this exception precisely? the so when try to catch this exception, the best way is check |
Beta Was this translation helpful? Give feedback.
Yes, for an XA transaction, you'll get an exception similar to the following:
MySqlConnector.MySqlException (0x80004005): XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
For a regular transaction, you'll get an exception similar to:
MySqlConnector.MySqlException: Deadlock found when trying to get lock; try restarting transaction