Allows use of externally owned transactions for writes#282
Conversation
|
Tagged Cloud PT, https://octopusdeploy.slack.com/archives/C01Q95KPRM4/p1709254205324879
|
I'm not following this. Previously The new I'm confused. |
You are totally right, I got myself confused while trying to use the MS convention on TryXXX methods... To not make this a breaking change I'll have to not use this convention |
|
This pull request has been linked to Shortcut Story #71481: Get agreement with PET regarding shared transaction between NSB and Nevermore. |
adam-mccoy
left a comment
There was a problem hiding this comment.
Blocking this one for further discussion.
| void CommitIfOwned(); | ||
| Task CommitIfOwnedAsync(CancellationToken cancellationToken = default); |
There was a problem hiding this comment.
Per the feedback on https://github.com/OctopusDeploy/OctopusDeploy/pull/23120, we'd rather not introduce a different way to commit a Nevermore transaction. Rather, the consumer (Octopus Server) should be aware of whether the SQL transaction is externally owned and simply not call Commit() on the Nevermore transaction in that case. Happy to assist with ways to solve that.
Nevermore already had the concept of accepting an external transaction to use for reads. This PR extends that behaviour to writes.
Commit()was renamed toTryCommit()to convey that it can now throw an exception if the externally provided transaction has already been committed elsewhere. This caused a lot of noise in the tests but I think the rename is valuable otherwise this would be a breaking change.[sc-71481]