Bug #98133 Docs on InnoDB Error Handling incorrect
Submitted: 6 Jan 2020 12:05 Modified: 8 Jan 2020 13:51
Reporter: Jan Uhlig Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.7, 8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: deadlocks, documentation, rollback

[6 Jan 2020 12:05] Jan Uhlig
Description:
https://dev.mysql.com/doc/refman/8.0/en/innodb-error-handling.html states that when a transaction is rolled back due to a deadlock, the START TRANSACTION or BEGIN statement itself is not rolled back, and any further statements execute inside a transaction. This was true with MySQL 5.6, but it seems to be no longer the case starting with 5.7, where it looks like said start-transaction statements are rolled back as well, and further statements are executed outside of a transaction.

I am a contributor to the mysql-otp project (https://github.com/mysql-otp/mysql-otp), a MySQL client/driver for Erlang.

We are using automated tests to test our client against MySQL 5.6, 5.7, and 8.0. One of those tests provokes a transaction deadlock, upon which the transaction is automatically retried. Starting with MySQL 5.7, when the first statement is retried, the OK packet returned from the server has the SERVER_IN_TRANS flag unset, while in 5.6 it remained set as described in the documentation.

While we were able to work around this, this seems to be a noteworthy change in behavior on MySQLs side, which may cause unwanted effects for applications relying on the old (pre-5.7) behavior.

How to repeat:
- provoke a transaction deadlock
- execute an arbitrary statement in the rolled-back transaction
- examine the SERVER_IN_TRANS status flag

Suggested fix:
Update the documentation.
[8 Jan 2020 13:51] MySQL Verification Team
Hello Mr. Uhlig,

Thank you for your bug report.

I have analysed the behaviour of our versions 5.7 and 8.0 and I have read the documentation.

I therefore conclude that your report is correct.

Verified as reported. Thank you.
[20 Jan 2020 16:46] Daniel Price
Posted by developer:
 
Reassigning to Development for investigation.
[21 Jan 2020 12:59] MySQL Verification Team
Thank you, Daniel.