[GODRIVER-3060] Investigate updating documentation for CommitTransaction Created: 27/Nov/23 Updated: 06/Dec/23 Resolved: 04/Dec/23 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Unknown |
| Reporter: | Preston Vasquez | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
||||||||
| Description |
Context
The underlying method that causes this issue is CommitTransaction. Perhaps the documentation for this method should include the context limitations. Definition of doneThe following questions should be answered and documented: 1. Can you cancel a context while committing a transaction? If yes, what is the difference between doing that and using WithTransaction, which is a convenience wrapper for CommitTransaction. What must be done to consider the task complete? PitfallsWhat should the implementer watch out for? What are the risks? |
| Comments |
| Comment by Preston Vasquez [ 06/Dec/23 ] |
|
rushil.kumar@mongodb.com The documentation for this should be drivers-wide, not specific to the Go Driver. You can cancel a context while committing a transaction, since reading the server response is context-oriented it's possible that a commit operation is successful but you still get an error on cancelation / timeout. When this occurs, you should just retry the transaction. I've created https://jira.mongodb.org/browse/DOCSP-34822 for the team to make this more clear at a documentation level. |
| Comment by Rushil Kumar [ 06/Dec/23 ] |
|
I am bit unclear on why this ticket was closed out. I don't think the questions in the ticket description were answered yet. |
| Comment by KeAna Moutra [ 04/Dec/23 ] |
|
The addition of this comment (in thread) suggests that we want users to avoid doing something we allow them to do. |
| Comment by Rushil Kumar [ 27/Nov/23 ] |
|
In addition, maybe it is worth updating the documentation for WithTransaction to indicate a cancellable-context can be passed in since it now wraps the passed in context with a background context? https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo#Session
|