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

Implicit transaction commits #11

Open
yogin opened this issue Aug 10, 2015 · 0 comments
Open

Implicit transaction commits #11

yogin opened this issue Aug 10, 2015 · 0 comments

Comments

@yogin
Copy link

yogin commented Aug 10, 2015

Hey @ageweke , it's been a while, how's it going?

We just started using this gem, because it was so helpful before ;)

However, we just stumbled on an issue with table locks.

We're using the DatabaseCleaner gem with Rspec, to cleanup the database around our specs. It has several strategies, and one of them is transaction, which uses savepoints to rollback queries.
https://dev.mysql.com/doc/refman/5.5/en/savepoint.html

It was working great until we added low_card_tables. Since it does a LOCK .. WRITE; ...; UNLOCK TABLES; when adding new rows, UNLOCK creates an implicit transaction COMMIT, so savepoints get released automatically. So the next time the DatabaseCleaner tries to release/rollback to a savepoint it will fail.
https://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html

The only solution to this I have found so far, is to change the strategy to truncation. This works, but it's much slower to run.

Wondering if you've encountered this issue before, and if you have other suggestions around this?

This could also have other side effects outside of running specs. Since it will commit any transaction you're in, possibly before you're done with your transaction.

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

No branches or pull requests

1 participant