GODRIVER-3889 Move commitTransaction and abortTransaction to the mongo package.#2473
GODRIVER-3889 Move commitTransaction and abortTransaction to the mongo package.#2473matthewdale wants to merge 3 commits into
Conversation
🧪 Performance ResultsCommit SHA: 5d392f2The following benchmark tests for version 6a56c1d4b5dbe1000779be8f had statistically significant changes (i.e., |z-score| > 1.96):
For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
API Change Report./v2/x/mongo/driver/operationincompatible changesAbortTransaction: removed |
There was a problem hiding this comment.
Pull request overview
This PR relocates the commitTransaction and abortTransaction operation implementations from x/mongo/driver/operation into the mongo package as unexported helpers, aligning with the ongoing effort to shrink/remove the x/mongo/driver/operation(s) surface area.
Changes:
- Removed
CommitTransactionandAbortTransactionoperation types (and their chainable setters) fromx/mongo/driver/operation. - Added unexported
commitTransactionOp/abortTransactionOpimplementations in themongopackage. - Updated
mongo.Session.CommitTransactionandmongo.Session.AbortTransactionto use the newmongo-package ops directly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| x/mongo/driver/operation/commit_transaction.go | Removed CommitTransaction operation implementation from the x operation package. |
| x/mongo/driver/operation/abort_transaction.go | Removed AbortTransaction operation implementation from the x operation package. |
| mongo/session.go | Switched session commit/abort paths to use unexported mongo-package ops instead of x/mongo/driver/operation. |
| mongo/op_commit_transaction.go | Added unexported commitTransactionOp implementation used by Session.CommitTransaction. |
| mongo/op_abort_transaction.go | Added unexported abortTransactionOp implementation used by Session.AbortTransaction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Lin Borland <lin.borland@mongodb.com>
| } | ||
|
|
||
| // Execute runs this operation and returns an error if the operation did not execute successfully. | ||
| func (ct *commitTransactionOp) Execute(ctx context.Context) error { |
There was a problem hiding this comment.
[nit] We should unexport method names. Additionally, is this more naturally a function? What are your thoughts?
func executeCommitTxn(ctx context.Context, ct commitTransactionOp) { }
GODRIVER-3889
Summary
Move the commitTransaction and abortTransaction operation logic from the
x/mongo/driver/operationspackage to themongopackage, removing the unnecessary chainable setters. Don't export the moved types.Background & Motivation
Part of a larger effort to reduce unnecessary code by removing the
x/mongo/driver/operationspackage.