-
-
Notifications
You must be signed in to change notification settings - Fork 503
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This change creates a `Transaction.savepoint` method, which is equivalent to `Transaction.transaction`, but takes a custom name for the nested transaction's savepoint name.
@@ -151,6 +151,7 @@ impl Config { | |||
pub struct Transaction<'conn> { | |||
conn: &'conn Connection, | |||
depth: u32, | |||
savepoint_name: Option<&'conn str>, |
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 an Option<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 documented in 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. |
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`.
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.