Skip to content

Fix #371 savepoint nameing in nested transactions #374

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

Conversation

rustonaut
Copy link

Rolling back to a savepoint doesn't release it so,
reusing the same name in nested transaction means
inner transactions only roll back to the
most transaction/last savepoint.

If the outer most transaction commits but did multiple
consecutive rollbacks in the nested transactions this
did cause an unexpected state in the database before
the fix.

Philipp Korber added 2 commits September 25, 2018 15:21
Rolling back to a savepoint doesn't release it so,
reusing the same name in nested transaction means
inner transactions only roll back to the
most transaction/last savepoint.

If the outer most transaction commits but did multiple
consecutive rollbacks in the nested transactions this
did cause an unexpected state in the database before
the fix.
@rustonaut
Copy link
Author

An alternate solution would be to change the rollback code to do a rollback followed by a release.
But this would get in the way for adding functionality for people allowing the full usage of savepoints.
I.e. adding a rollback_and_retry functionality (which rolls back the transaction and restarts it, expect that it's "just" a rollback as we have savepoints and not nested transactions).

@rustonaut rustonaut changed the title Fix 371 savepoint nameing in nested transactions Fix #371 savepoint nameing in nested transactions Sep 25, 2018
@sfackler
Copy link
Owner

This seems like a nicer solution than rollback + release, thanks!

@sfackler sfackler merged commit 86b65aa into sfackler:master Sep 26, 2018
nvb added a commit to nvb/rust-postgres that referenced this pull request May 1, 2020
Revives sfackler#184.

The rewrite for async/await and Tokio accidentally lost functionality
that allowed users to assign specific names to savepoints when using
nested transactions. This functionality had originally been added
in sfackler#184 and had been updated in sfackler#374.

This commit revives this functionality using a similar scheme to the
one that existed before. This should allow CockroachDB users to update
to the next patch release of version `0.17`.
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