-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transaction isolation level should not default to REPEATABLE READ
regardless of server configuration if left unspecified
#1442
Comments
I think this comment explains the current behaviour: PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#1043 (comment)
IMO, the documentation doesn't state or imply that an implicit server-set default will be used if not specified by the client. I'm a little reticent to change this because
|
I can understand that this would be a pretty big API break and the use case is likely niche, but I hope it is also understandable that the current behaviour results in a rather unexpected and confusing outcome. Maybe at least a remark in documentation could be added for posterity? |
Yes, this should certainly be clearly documented. FWIW, MySql.Data also defaults to |
Software versions
MySqlConnector version: 2.1.6, but still relevant on latest
master
as far as I can tellServer type (MySQL, MariaDB, Aurora, etc.) and version: Not relevant
.NET version: Not relevant
Describe the bug
If a transaction is started without specifying an isolation level, it will silently default to
IsolationLevel.Unspecified
, which is really justREPEATABLE READ
:MySqlConnector/src/MySqlConnector/MySqlConnection.cs
Lines 155 to 156 in 999a3ab
The comment is correct in stating that
REPEATABLE READ
is the default innodb transaction isolation level, however, this is confusing in cases where the global transaction isolation level on the mysql instance that queries are directed to is deliberately changed from the configuration default.Related: #772
Exception
Not applicable
Code sample
See usage. On a mysql transaction with
READ COMMITTED
default transaction isolation level this would instead forceREPEATABLE READ
and as such caused a long investigation into ensuing deadlocks, that was "fixed" by ppy/osu-queue-score-statistics@5c23e0f.Expected behavior
MySqlConnector
does not attempt to explicitly set any transaction isolation level when starting a transaction withIsolationLevel.Unspecified
.Additional context
Not applicable
The text was updated successfully, but these errors were encountered: