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

postgres begin cancel safe #2819

Merged

Conversation

conradludgate
Copy link
Contributor

This attempts to make Postgres's begin step more cancel safe than it used to be.

  1. Using execute to perform a begin is overkill, so I have switched to using the simple query protocol like sqlx uses in drop-rollback - this is inspired by tokio-postgres.
  2. Implement a short lived drop-rollback struct to start the rollback incase of error/panic/cancel during wait_until_ready

Because we guarantee to write a BEGIN/SAVEPOINT to the PgStream, any drops will definitely rollback to that point and not to a parent BEGIN. The previous impl could be cancelled at the prepare/bind and not need to be rolled back, so applying this drop guard would not be so safe

cc #2805

@conradludgate
Copy link
Contributor Author

I'm not familiar enough with mysql or sqlite to say whether this same patch will work

@abonander abonander merged commit f93bbe8 into launchbadge:main Oct 17, 2023
64 checks passed
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