Skip to content
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

GODRIVER-2388 Improved Bulk Write API. #1884

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

qingyang-hu
Copy link
Collaborator

GODRIVER-2388
GODRIVER-3348
GODRIVER-3349
GODRIVER-3364

Summary

Improved Bulk Write API.

Background & Motivation

Refactor the (Operation).createWireMessage() to support the bulk write batching.

@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the priority-3-low Low Priority PR for Review label Nov 5, 2024
Copy link
Contributor

API Change Report

./v2/mongo

compatible changes

(*Client).BulkWrite: added
ClientBulkWriteException: added
ClientBulkWriteResult: added
ClientDeleteManyModel: added
ClientDeleteOneModel: added
ClientDeleteResult: added
ClientInsertOneModel: added
ClientInsertResult: added
ClientReplaceOneModel: added
ClientUpdateManyModel: added
ClientUpdateOneModel: added
ClientUpdateResult: added
ClientWriteModels: added
NewClientDeleteManyModel: added
NewClientDeleteOneModel: added
NewClientInsertOneModel: added
NewClientReplaceOneModel: added
NewClientUpdateManyModel: added
NewClientUpdateOneModel: added

./v2/mongo/options

compatible changes

ClientBulkWrite: added
ClientBulkWriteOptions: added
ClientBulkWriteOptionsBuilder: added

./v2/x/mongo/driver

incompatible changes

(*Batches).AdvanceBatch: removed
(*Batches).ClearBatch: removed
(*Batches).Valid: removed
Batches.Current: removed
##NewCursorResponse: changed from func(ResponseInfo) (CursorResponse, error) to func(./v2/x/bsonx/bsoncore.Document, ResponseInfo) (CursorResponse, error)
Operation.Batches: changed from *Batches to interface{AdvanceBatches(n int); AppendBatchArray(dst []byte, maxCount int, maxDocSize int, totalSize int) (int, []byte, error); AppendBatchSequence(dst []byte, maxCount int, maxDocSize int, totalSize int) (int, []byte, error); IsOrdered() *bool; Size() int}
##Operation.ProcessResponseFn: changed from func(ResponseInfo) error to func(context.Context, ./v2/x/bsonx/bsoncore.Document, ResponseInfo) error
ResponseInfo.ServerResponse: removed

compatible changes

(*Batches).AdvanceBatches: added
(*Batches).AppendBatchArray: added
(*Batches).AppendBatchSequence: added
(*Batches).IsOrdered: added
(*Batches).Size: added
ExtractCursorDocument: added
ResponseInfo.Error: added

./v2/x/mongo/driver/session

incompatible changes

Client.RetryRead: removed
Client.RetryWrite: removed

./v2/x/mongo/driver/wiremessage

compatible changes

DocumentSequenceToArray: added

@@ -398,7 +398,7 @@ func TestClientSideEncryptionCustomCrypt(t *testing.T) {
"expected 0 calls to DecryptExplicit, got %v", cc.numDecryptExplicitCalls)
assert.Equal(mt, cc.numCloseCalls, 0,
"expected 0 calls to Close, got %v", cc.numCloseCalls)
assert.Equal(mt, cc.numBypassAutoEncryptionCalls, 2,
assert.Equal(mt, cc.numBypassAutoEncryptionCalls, 1,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only call it once after the operation.go refactoring.

// A top-level error that occurred when attempting to communicate with the server
// or execute the bulk write. This value may not be populated if the exception was
// thrown due to errors occurring on individual writes.
TopLevelError *WriteError
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot use Error as a field name because of the conflict with the conventional method name.

@qingyang-hu qingyang-hu marked this pull request as ready for review November 5, 2024 20:18
@qingyang-hu qingyang-hu added priority-2-medium Medium Priority PR for Review and removed priority-3-low Low Priority PR for Review labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-2-medium Medium Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant