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

[BUG][MySQL] Isolation level not respected when used with access mode #2450

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

jreppnow
Copy link
Contributor

PR Info

Hi, I discovered this while writing some data migration logic using IsolationLevel::Serializable, yet getting some results which where definitely not serializable (locks not applied). So I checked the sea_orm transaction code and realized that, if you specify an AccessMode together with your IsolationLevel when begin_with_config(), sea_orm does this in two statements. This is HIGHLY problematic as MySQL expects this to be one query (https://dev.mysql.com/doc/refman/8.0/en/set-transaction.html) and reverts the IsolationLevel setting back to the default, which is ConsistentRead.

This pull requests fixes this issue. Considering that this can very easily result in some very bad data issues, I would consider this a very high urgency issue!!

Bug Fixes

  • See above. Basically, if you specify an AccessMode, your IsolationLevel setting is ignored (very bad).

Changes

  • Perform the setting in one query.

@tyt2y3 tyt2y3 changed the title [BUG][MySQL] IsolationLevel not respected in some cases [BUG][MySQL] Isolation level not respected when used with access mode Dec 23, 2024
Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! I think you're right

@tyt2y3 tyt2y3 merged commit 525ec30 into SeaQL:master Dec 23, 2024
36 checks passed
Copy link

🎉 Released In 1.1.3 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

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

Successfully merging this pull request may close these issues.

2 participants