Skip to content

Ability to use session transaction isolation level #801

Description

@bgrainger

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.

Activity

  1. added a commit that references this issue on Apr 18, 2020
    7ec2228
  2. bgrainger commented on Apr 18, 2020

    @bgrainger
    MemberAuthor

    Hardcoded to always use SESSION in 0.64.0.

  3. bgrainger commented on Jul 14, 2020

    @bgrainger
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions