Bug #106435 8.0.28 Connector/J has regressive in setAutoCommit after Bug#104067 (33054827)
Submitted: 10 Feb 2022 15:02 Modified: 6 Apr 2022 21:53
Reporter: Sergey Grachov (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:8.0.28 OS:Any
Assigned to: CPU Architecture:Any
Tags: autocommit, connector, jdbc

[10 Feb 2022 15:02] Sergey Grachov
Description:
ConnectionImpl doesn't maintain correct autoCommit state when used in pools with useLocalSessionState=true due to Bug#104067 (33054827) bugfix:

How to repeat:
just see the diff. https://github.com/mysql/mysql-connector-j/commit/4d19ea1a60ac9e97aae9074190c08c6f097a00ed

Suggested fix:
(1) i suppose it should have been isAutoCommit() in line 2041, not isAutocommit() which is an obvious mistype
(2) would be nice to have isAutocommit() method renamed to something like isStatusFlagAutocommit() to avoid that kind of confusion

https://github.com/mysql/mysql-connector-j/commit/4d19ea1a60ac9e97aae9074190c08c6f097a00ed

+             boolean isAutocommit = this.session.getServerSession().isAutocommit();
...
-                if (this.useLocalSessionState.getValue() && this.session.getServerSession().isAutoCommit() == autoCommitFlag) {
+                if (this.useLocalSessionState.getValue() && isAutocommit == autoCommitFlag) {
[11 Feb 2022 12:59] MySQL Verification Team
Thanks for the report Sergey,

all best
[6 Apr 2022 21:53] Daniel So
Posted by developer:
 
Added the following entry to the Connector/J 8.0.29 changelog: 

"A connection did not maintain the correct autocommit state when it was used in a pool with useLocalSessionState=true.
References: This issue is a regression of: Bug #33054827."