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. #1805

Closed
wants to merge 15 commits into from

Conversation

qingyang-hu
Copy link
Collaborator

@qingyang-hu qingyang-hu commented Sep 11, 2024

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 Sep 11, 2024
Copy link
Contributor

mongodb-drivers-pr-bot bot commented Sep 11, 2024

API Change Report

./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

./mongo/options

compatible changes

ClientBulkWrite: added
ClientBulkWriteOptions: added
MergeClientBulkWriteOptions: added

./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(./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, ./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

./x/mongo/driver/session

incompatible changes

Client.RetryWrite: removed

./x/mongo/driver/wiremessage

incompatible changes

ReadCompressedCompressedMessage: removed

compatible changes

DocumentSequenceToArray: added

@qingyang-hu qingyang-hu force-pushed the godriver2388 branch 3 times, most recently from 234d7f4 to 8f81f65 Compare September 27, 2024 22:29
@qingyang-hu qingyang-hu force-pushed the godriver2388 branch 2 times, most recently from 8ea5dc5 to 4f738e2 Compare September 29, 2024 20:25
@qingyang-hu qingyang-hu force-pushed the godriver2388 branch 6 times, most recently from ba9f578 to d2d8a49 Compare October 12, 2024 05:16
@qingyang-hu qingyang-hu force-pushed the godriver2388 branch 7 times, most recently from 76a9981 to e3dcc91 Compare October 13, 2024 21:08
@qingyang-hu qingyang-hu force-pushed the godriver2388 branch 5 times, most recently from dec06b9 to ed94cf9 Compare October 16, 2024 20:59
@@ -396,7 +396,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.

@@ -609,6 +609,50 @@ func (bwe BulkWriteException) HasErrorCodeWithMessage(code int, message string)
// serverError implements the ServerError interface.
func (bwe BulkWriteException) serverError() {}

// ClientBulkWriteException is the error type returned by ClientBulkWrite operations.
type ClientBulkWriteException struct {
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 force-pushed the godriver2388 branch 3 times, most recently from f0cd171 to c80bb4f Compare October 22, 2024 17:48
@qingyang-hu qingyang-hu force-pushed the godriver2388 branch 2 times, most recently from bf90492 to 48838bf Compare October 24, 2024 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant