Github user jburwell commented on the issue:
https://github.com/apache/cloudstack/pull/1762
@yvsubhash according to the (MySQL deadlock
documenation)[http://dev.mysql.com/doc/refman/5.7/en/innodb-deadlocks.html], a
`MYSQL_DEADLOCK_ERROR_CODE` error indicates the enclosing transaction has been
rolled back. The proper handling for this error is to re-execute all
statements executed in the aborted transaction. From a best practices
perspective, all base data should be re-retrieved and changed to ensure logical
consistency with changes made by the transaction that won deadlock resolution.
As I understand this patch, only the most recently executed DML is retried.
Therefore, any previously executed changes will be discarded and the DML will
be re-executed either in a new transaction or in auto-commit (I didn't look up
how the client handles the transaction context in this scenario). If my
understanding is correct, this patch could lead to issues ranging from
unexpected foreign key integrity errors to data corruption.
Rather attempting to implement a generic retry, I think the best approach
to addressing deadlocks is to treat them bugs. This patch could be modified to
provide detailed logging information about the conditions under which a
deadlock occurs providing the information necessary to refactor the system to
avoid lock contention.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---