- Notifications
You must be signed in to change notification settings - Fork516
Add savepoint method to Transaction#184
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This change creates a `Transaction.savepoint` method, which is equivalentto `Transaction.transaction`, but takes a custom name for the nestedtransaction's savepoint name.
src/transaction.rs Outdated
pubstructTransaction<'conn>{ | ||
conn:&'connConnection, | ||
depth:u32, | ||
savepoint_name:Option<&'connstr>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'd just make this anOption<String>
- the runtime cost of the allocation is ~0 compared to talking over the network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sounds good to me. How's that?
I'll squash the commits down to one if/when this PR gets the thumbs up by the way.
👍 Thanks! |
Hi@sfackler! I noticed that this functionality was lost in the newest release ( For context, CockroachDB is still very interested in this functionality for the same reason as we originally discussed in#179. This client-side retry pattern is documentedin the CRDB docs and we'd love to be able to get people onto the newest version of this library. This is especially true because we've seen an uptick in people using Rust with CRDB recently (including me on a few side projects 😃) and also an uptick in people interested in Tokio + async/await. |
Oops - the removal was an oversight during the big rewrite. Happy to take a PR adding it back, or I can put one up at some point alternatively. |
Great! I'll try to get a PR out for this today. |
Revivesrust-postgres#184.The rewrite for async/await and Tokio accidentally lost functionalitythat allowed users to assign specific names to savepoints when usingnested transactions. This functionality had originally been addedinrust-postgres#184 and had been updated inrust-postgres#374.This commit revives this functionality using a similar scheme to theone that existed before. This should allow CockroachDB users to updateto the next patch release of version `0.17`.
Fixes#179
This change creates a
Transaction.savepoint
method, which is equivalentto
Transaction.transaction
, but takes a custom name for the nestedtransaction's savepoint name.