Bug #70785 | MySQL Connector/J inconsistent init state for autocommit | ||
---|---|---|---|
Submitted: | 31 Oct 2013 12:39 | Modified: | 7 Feb 2017 19:52 |
Reporter: | Ivan Prisyazhniy | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 5.1.26 | OS: | Linux (x86_64, ubuntu/debian) |
Assigned to: | Filipe Silva | CPU Architecture: | Any |
Tags: | autocommit cache variables init elide |
[31 Oct 2013 12:39]
Ivan Prisyazhniy
[31 Oct 2013 14:16]
Ivan Prisyazhniy
a little bit wrong with use of @@autocommit. you must use SHOW SESSION VARIABLES LIKE 'autocommit' everywhere instead of @@autocommit in my description of bug
[31 Oct 2013 15:30]
Ivan Prisyazhniy
init-connect was set to 'SET NAMES utf8'
[7 Nov 2013 9:47]
Alexander Soklakov
Hi Ivan, Thanks for you report. Verified as described.
[21 Oct 2016 16:47]
Rei Mai
The problem with serverStatus is that although set correctly during handshake, it's later reset to 0 by checkErrorPacket(), so it's 0 in initializePropsFromServer. And the actual value of "init_connect" variable is not checked in isAutoCommitNonDefaultOnServer. I have no idea why checkErrorPacket drops serverStatus, so in my project I worked the issue around by just checking serverStatus via "SELECT @@session.autocommit" even in case of elideSetAutoCommits set to true and checking the value of "init_connect". Do plan to fix serverState workflow or should I submit a patch with the workaround? The issue is pretty serious and it's gonna be 3yrs old next week.
[7 Feb 2017 19:52]
Daniel So
Posted by developer: Added the following entry to the Connector/J 5.1.41 changelog: "With the connection properties cacheServerConfiguration=true, useLocalSessionState=true, and elideSetAutoCommits=true, any new connection to the server obtained after the first connection was established had the variable autoCommit equaled false, even if the value of the variable was true on the server. That was because the value of autoCommit was not properly initialized when a new connection was established, and this fix corrects that."