Skip to content
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

Ability to use session transaction isolation level #801

Closed
bgrainger opened this issue Apr 18, 2020 · 2 comments
Closed

Ability to use session transaction isolation level #801

bgrainger opened this issue Apr 18, 2020 · 2 comments

Comments

@bgrainger
Copy link
Member

@bgrainger bgrainger commented Apr 18, 2020

The transaction isolation level (MySQL docs) can be set one of two ways:

  1. SET SESSION TRANSACTION ISOLATION LEVEL
  2. SET TRANSACTION ISOLATION LEVEL

(1) changes the isolation level for all future transactions issued on the current connection (unless it's changed again); (2) changes it for just the next transaction.

Connector/NET does (1), MySqlConnector does (2).

(2) seems like a better fit for the ADO.NET API, because BeginTransaction(IsolationLevel) clearly just affects that specific transaction. However, it's reportedly incompatible with ProxySQL: PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#1043 (comment), sysown/proxysql#2305 (comment).

If all usages of transactions are through the ADO.NET API, then the difference should not be observable because the isolation level will always be set before each transaction. But if code is manually executing START TRANSACTION, it would be affected by the server default or session isolation level.

We could add a new connection string option that controls whether SESSION isolation levels are used. Alternatively, because the difference probably isn't observable (or may even be relied on by code being ported from Connector/NET), we could change change the default implementation in MySqlConnector for everyone.

@bgrainger
Copy link
Member Author

@bgrainger bgrainger commented Apr 18, 2020

Hardcoded to always use SESSION in 0.64.0.

@bgrainger
Copy link
Member Author

@bgrainger bgrainger commented Jul 14, 2020

MySQL Connector/NET changed from (1) to (2) in 8.0.21: https://bugs.mysql.com/bug.php?id=86263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant