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

Request: support Rails 6 lazy transactions #218

Open
georgeclaghorn opened this issue Aug 28, 2018 · 1 comment
Open

Request: support Rails 6 lazy transactions #218

georgeclaghorn opened this issue Aug 28, 2018 · 1 comment

Comments

@georgeclaghorn
Copy link
Contributor

georgeclaghorn commented Aug 28, 2018

Rails 6 will add lazy transactions, wherein a call to ActiveRecord::Base.transaction won’t cause a BEGIN statement to be sent to the DBMS until the first read or write. If no read or write occurs inside the transaction block, no COMMIT statement is sent, either. The benefit of this change is that a call to ActiveRecord::Base#save which doesn’t result in any queries (for example, because the record’s attributes didn’t change) won’t incur an empty transaction.

But Makara sticks to the primary for the remainder of a request after the first call to ActiveRecord::Base.transaction, even if no DB transaction actually occurs. Ideally, Makara would wait for the BEGIN to stick to the primary.

@bleonard
Copy link
Contributor

bleonard commented Aug 28, 2018

That's cool. It sounds like as you say, BEGIN and COMMIT should trigger the same transaction code that the .transaction block does now. Maybe we should stop doing the block altogether or maybe we should have a Rails version check.

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

2 participants