diff --git a/mongo/client.go b/mongo/client.go index 039583372e..5da2d5be2e 100644 --- a/mongo/client.go +++ b/mongo/client.go @@ -876,14 +876,10 @@ func (c *Client) BulkWrite(ctx context.Context, models *ClientWriteModels, return nil, err } - wc := c.writeConcern - if bwo.WriteConcern != nil { - wc = bwo.WriteConcern + if sess.TransactionRunning() && bwo.WriteConcern != nil { + return nil, errors.New("cannot set write concern after starting a transaction") } - if sess.TransactionRunning() { - wc = nil - } - if !writeconcern.AckWrite(wc) { + if !writeconcern.AckWrite(bwo.WriteConcern) { sess = nil } @@ -902,7 +898,7 @@ func (c *Client) BulkWrite(ctx context.Context, models *ClientWriteModels, session: sess, client: c, selector: selector, - writeConcern: wc, + writeConcern: bwo.WriteConcern, } if bwo.VerboseResults == nil || !(*bwo.VerboseResults) { op.errorsOnly = true diff --git a/mongo/client_bulk_write.go b/mongo/client_bulk_write.go index f4b9466704..8ec9814d9f 100644 --- a/mongo/client_bulk_write.go +++ b/mongo/client_bulk_write.go @@ -8,6 +8,7 @@ package mongo import ( "context" + "errors" "strconv" "go.mongodb.org/mongo-driver/bson" @@ -40,6 +41,9 @@ type clientBulkWrite struct { } func (bw *clientBulkWrite) execute(ctx context.Context) error { + if len(bw.models) == 0 { + return errors.New("empty write models") + } docs := make([]bsoncore.Document, len(bw.models)) nsMap := make(map[string]int) var nsList []string @@ -170,12 +174,21 @@ func (bw *clientBulkWrite) execute(ctx context.Context) error { Database("admin"). Deployment(bw.client.deployment).Crypt(bw.client.cryptFLE). ServerAPI(bw.client.serverAPI).Timeout(bw.client.timeout). - Logger(bw.client.logger).Authenticator(bw.client.authenticator) - err := op.Execute(ctx) - if err != nil { - return err + Logger(bw.client.logger).Authenticator(bw.client.authenticator).Name("bulkWrite") + opErr := op.Execute(ctx) + var wcErrs []*WriteConcernError + if opErr != nil { + if errors.Is(opErr, driver.ErrUnacknowledgedWrite) { + return nil + } + var writeErr driver.WriteCommandError + if errors.As(opErr, &writeErr) { + wcErr := convertDriverWriteConcernError(writeErr.WriteConcernError) + wcErrs = append(wcErrs, wcErr) + } } var res struct { + Ok bool Cursor struct { FirstBatch []bson.Raw } @@ -184,10 +197,12 @@ func (bw *clientBulkWrite) execute(ctx context.Context) error { NMatched int32 NModified int32 NUpserted int32 + NErrors int32 + Code int32 + Errmsg string } rawRes := op.Result() - err = bson.Unmarshal(rawRes, &res) - if err != nil { + if err := bson.Unmarshal(rawRes, &res); err != nil { return err } bw.result.DeletedCount = int64(res.NDeleted) @@ -195,22 +210,35 @@ func (bw *clientBulkWrite) execute(ctx context.Context) error { bw.result.MatchedCount = int64(res.NMatched) bw.result.ModifiedCount = int64(res.NModified) bw.result.UpsertedCount = int64(res.NUpserted) + errors := make(map[int64]WriteError) for i, cur := range res.Cursor.FirstBatch { switch res := resMap[i].(type) { case map[int64]ClientDeleteResult: - if err = appendDeleteResult(cur, res); err != nil { + if err := appendDeleteResult(cur, res, errors); err != nil { return err } case map[int64]ClientInsertResult: - if err = appendInsertResult(cur, res, insIDMap); err != nil { + if err := appendInsertResult(cur, res, errors, insIDMap); err != nil { return err } case map[int64]ClientUpdateResult: - if err = appendUpdateResult(cur, res); err != nil { + if err := appendUpdateResult(cur, res, errors); err != nil { return err } } } + if !res.Ok || res.NErrors > 0 || opErr != nil { + return ClientBulkWriteException{ + TopLevelError: &WriteError{ + Code: int(res.Code), + Message: res.Errmsg, + Raw: bson.Raw(rawRes), + }, + WriteConcernErrors: wcErrs, + WriteErrors: errors, + PartialResult: &bw.result, + } + } return nil } @@ -383,45 +411,75 @@ func createClientDeleteDoc( return bsoncore.AppendDocumentEnd(doc, didx) } -func appendDeleteResult(cur bson.Raw, m map[int64]ClientDeleteResult) error { +func appendDeleteResult(cur bson.Raw, m map[int64]ClientDeleteResult, e map[int64]WriteError) error { var res struct { - Idx int32 - N int32 + Ok bool + Idx int32 + N int32 + Code int32 + Errmsg string } if err := bson.Unmarshal(cur, &res); err != nil { return err } - m[int64(res.Idx)] = ClientDeleteResult{int64(res.N)} + if res.Ok { + m[int64(res.Idx)] = ClientDeleteResult{int64(res.N)} + } else { + e[int64(res.Idx)] = WriteError{ + Code: int(res.Code), + Message: res.Errmsg, + } + } return nil } -func appendInsertResult(cur bson.Raw, m map[int64]ClientInsertResult, insIdMap map[int]interface{}) error { +func appendInsertResult(cur bson.Raw, m map[int64]ClientInsertResult, e map[int64]WriteError, insIDMap map[int]interface{}) error { var res struct { - Idx int32 + Ok bool + Idx int32 + Code int32 + Errmsg string } if err := bson.Unmarshal(cur, &res); err != nil { return err } - m[int64(res.Idx)] = ClientInsertResult{insIdMap[int(res.Idx)]} + if res.Ok { + m[int64(res.Idx)] = ClientInsertResult{insIDMap[int(res.Idx)]} + } else { + e[int64(res.Idx)] = WriteError{ + Code: int(res.Code), + Message: res.Errmsg, + } + } return nil } -func appendUpdateResult(cur bson.Raw, m map[int64]ClientUpdateResult) error { +func appendUpdateResult(cur bson.Raw, m map[int64]ClientUpdateResult, e map[int64]WriteError) error { var res struct { + Ok bool Idx int32 N int32 NModified int32 Upserted struct { ID interface{} `bson:"_id"` } + Code int32 + Errmsg string } if err := bson.Unmarshal(cur, &res); err != nil { return err } - m[int64(res.Idx)] = ClientUpdateResult{ - MatchedCount: int64(res.N), - ModifiedCount: int64(res.NModified), - UpsertedID: res.Upserted.ID, + if res.Ok { + m[int64(res.Idx)] = ClientUpdateResult{ + MatchedCount: int64(res.N), + ModifiedCount: int64(res.NModified), + UpsertedID: res.Upserted.ID, + } + } else { + e[int64(res.Idx)] = WriteError{ + Code: int(res.Code), + Message: res.Errmsg, + } } return nil } diff --git a/mongo/errors.go b/mongo/errors.go index b4de6224b3..180cc8ce7f 100644 --- a/mongo/errors.go +++ b/mongo/errors.go @@ -611,10 +611,10 @@ func (bwe BulkWriteException) serverError() {} // ClientBulkWriteException is the error type returned by ClientBulkWrite operations. type ClientBulkWriteException struct { - TopLevelError *error + TopLevelError *WriteError // The write concern errors that occurred. - WriteConcernErrors []WriteConcernError + WriteConcernErrors []*WriteConcernError // The write errors that occurred during individual operation execution. WriteErrors map[int64]WriteError @@ -626,12 +626,12 @@ type ClientBulkWriteException struct { func (bwe ClientBulkWriteException) Error() string { causes := make([]string, 0, 4) if bwe.TopLevelError != nil { - causes = append(causes, "top level error: "+(*bwe.TopLevelError).Error()) + causes = append(causes, "top level error: "+bwe.TopLevelError.Error()) } if len(bwe.WriteConcernErrors) > 0 { errs := make([]error, len(bwe.WriteConcernErrors)) for i := 0; i < len(bwe.WriteConcernErrors); i++ { - errs[i] = &bwe.WriteConcernErrors[i] + errs[i] = bwe.WriteConcernErrors[i] } causes = append(causes, "write concern errors: "+joinBatchErrors(errs)) } @@ -643,7 +643,7 @@ func (bwe ClientBulkWriteException) Error() string { causes = append(causes, "write errors: "+joinBatchErrors(errs)) } if bwe.PartialResult != nil { - causes = append(causes, fmt.Sprintf("result: %v", bwe.PartialResult)) + causes = append(causes, fmt.Sprintf("result: %v", *bwe.PartialResult)) } message := "bulk write exception: " @@ -653,9 +653,6 @@ func (bwe ClientBulkWriteException) Error() string { return "bulk write exception: " + strings.Join(causes, ", ") } -// serverError implements the ServerError interface. -func (bwe ClientBulkWriteException) serverError() {} - // returnResult is used to determine if a function calling processWriteError should return // the result or return nil. Since the processWriteError function is used by many different // methods, both *One and *Many, we need a way to differentiate if the method should return diff --git a/mongo/integration/unified/error.go b/mongo/integration/unified/error.go index 0edc79428a..f69a3da341 100644 --- a/mongo/integration/unified/error.go +++ b/mongo/integration/unified/error.go @@ -182,6 +182,9 @@ func extractErrorDetails(err error) (errorDetails, bool) { details.raw = we.Raw } details.labels = converted.Labels + case mongo.ClientBulkWriteException: + details.raw = converted.TopLevelError.Raw + details.codes = append(details.codes, int32(converted.TopLevelError.Code)) default: return errorDetails{}, false } diff --git a/mongo/integration/unified/schema_version.go b/mongo/integration/unified/schema_version.go index 9aec89a18d..c3d02068a3 100644 --- a/mongo/integration/unified/schema_version.go +++ b/mongo/integration/unified/schema_version.go @@ -16,7 +16,7 @@ import ( var ( supportedSchemaVersions = map[int]string{ - 1: "1.17", + 1: "1.21", } ) diff --git a/testdata/retryable-writes/unified/handshakeError.json b/testdata/retryable-writes/unified/handshakeError.json deleted file mode 100644 index 93cb2e849e..0000000000 --- a/testdata/retryable-writes/unified/handshakeError.json +++ /dev/null @@ -1,2015 +0,0 @@ -{ - "description": "retryable writes handshake failures", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "auth": true - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "connectionCheckOutStartedEvent", - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-handshake-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "client.clientBulkWrite succeeds after retryable handshake network error", - "runOnRequirements": [ - { - "minServerVersion": "8.0", - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "clientBulkWrite", - "object": "client", - "arguments": { - "models": [ - { - "insertOne": { - "namespace": "retryable-writes-handshake-tests.coll", - "document": { - "_id": 8, - "x": 88 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandSucceededEvent": { - "commandName": "bulkWrite" - } - } - ] - } - ] - }, - { - "description": "client.clientBulkWrite succeeds after retryable handshake server error (ShutdownInProgress)", - "runOnRequirements": [ - { - "minServerVersion": "8.0", - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "clientBulkWrite", - "object": "client", - "arguments": { - "models": [ - { - "insertOne": { - "namespace": "retryable-writes-handshake-tests.coll", - "document": { - "_id": 8, - "x": 88 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandSucceededEvent": { - "commandName": "bulkWrite" - } - } - ] - } - ] - }, - { - "description": "collection.insertOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.insertOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.insertMany succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.insertMany succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.deleteOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandSucceededEvent": { - "commandName": "delete" - } - } - ] - } - ] - }, - { - "description": "collection.deleteOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandSucceededEvent": { - "commandName": "delete" - } - } - ] - } - ] - }, - { - "description": "collection.replaceOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.replaceOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.updateOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.updateOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndDelete succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndDelete succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndReplace succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndReplace succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndUpdate succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndUpdate succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.bulkWrite succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.bulkWrite succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - } - ] -} diff --git a/testdata/retryable-writes/unified/handshakeError.yml b/testdata/retryable-writes/unified/handshakeError.yml deleted file mode 100644 index 1743463370..0000000000 --- a/testdata/retryable-writes/unified/handshakeError.yml +++ /dev/null @@ -1,877 +0,0 @@ -# Tests in this file are generated from handshakeError.yml.template. - -description: "retryable writes handshake failures" - -schemaVersion: "1.4" # For `serverless: forbid` - -runOnRequirements: - - minServerVersion: "4.2" - topologies: [replicaset, sharded, load-balanced] - auth: true - -createEntities: - - client: - id: &client client - useMultipleMongoses: false - observeEvents: - - connectionCheckOutStartedEvent - - commandStartedEvent - - commandSucceededEvent - - commandFailedEvent - - database: - id: &database database - client: *client - databaseName: &databaseName retryable-writes-handshake-tests - - collection: - id: &collection collection - database: *database - collectionName: &collectionName coll - -initialData: - - collectionName: *collectionName - databaseName: *databaseName - documents: - - { _id: 1, x: 11 } - -tests: - # Because setting a failPoint creates a connection in the connection pool, run - # a ping operation that fails immediately after the failPoint operation in - # order to discard the connection before running the actual operation to be - # tested. The saslContinue command is used to avoid SDAM errors. - # - # Description of events: - # - Failpoint operation. - # - Creates a connection in the connection pool that must be closed. - # - Ping operation. - # - Triggers failpoint (first time). - # - Closes the connection made by the fail point operation. - # - Test operation. - # - New connection is created. - # - Triggers failpoint (second time). - # - Tests whether operation successfully retries the handshake and succeeds. - - - description: "client.clientBulkWrite succeeds after retryable handshake network error" - runOnRequirements: - - minServerVersion: "8.0" # `bulkWrite` added to server 8.0 - serverless: forbid - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: clientBulkWrite - object: *client - arguments: - models: - - insertOne: - namespace: retryable-writes-handshake-tests.coll - document: { _id: 8, x: 88 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: bulkWrite - - commandSucceededEvent: - commandName: bulkWrite - - - description: "client.clientBulkWrite succeeds after retryable handshake server error (ShutdownInProgress)" - runOnRequirements: - - minServerVersion: "8.0" # `bulkWrite` added to server 8.0 - serverless: forbid - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: clientBulkWrite - object: *client - arguments: - models: - - insertOne: - namespace: retryable-writes-handshake-tests.coll - document: { _id: 8, x: 88 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: bulkWrite - - commandSucceededEvent: - commandName: bulkWrite - - - description: "collection.insertOne succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: insertOne - object: *collection - arguments: - document: { _id: 2, x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: insert - - commandSucceededEvent: - commandName: insert - - - description: "collection.insertOne succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: insertOne - object: *collection - arguments: - document: { _id: 2, x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: insert - - commandSucceededEvent: - commandName: insert - - - description: "collection.insertMany succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: insertMany - object: *collection - arguments: - documents: - - { _id: 2, x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: insert - - commandSucceededEvent: - commandName: insert - - - description: "collection.insertMany succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: insertMany - object: *collection - arguments: - documents: - - { _id: 2, x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: insert - - commandSucceededEvent: - commandName: insert - - - description: "collection.deleteOne succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: deleteOne - object: *collection - arguments: - filter: {} - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: delete - - commandSucceededEvent: - commandName: delete - - - description: "collection.deleteOne succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: deleteOne - object: *collection - arguments: - filter: {} - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: delete - - commandSucceededEvent: - commandName: delete - - - description: "collection.replaceOne succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: replaceOne - object: *collection - arguments: - filter: {} - replacement: { x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: update - - commandSucceededEvent: - commandName: update - - - description: "collection.replaceOne succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: replaceOne - object: *collection - arguments: - filter: {} - replacement: { x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: update - - commandSucceededEvent: - commandName: update - - - description: "collection.updateOne succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: updateOne - object: *collection - arguments: - filter: {} - update: { $set: { x: 22 } } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: update - - commandSucceededEvent: - commandName: update - - - description: "collection.updateOne succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: updateOne - object: *collection - arguments: - filter: {} - update: { $set: { x: 22 } } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: update - - commandSucceededEvent: - commandName: update - - - description: "collection.findOneAndDelete succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: findOneAndDelete - object: *collection - arguments: - filter: {} - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: findAndModify - - commandSucceededEvent: - commandName: findAndModify - - - description: "collection.findOneAndDelete succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: findOneAndDelete - object: *collection - arguments: - filter: {} - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: findAndModify - - commandSucceededEvent: - commandName: findAndModify - - - description: "collection.findOneAndReplace succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: findOneAndReplace - object: *collection - arguments: - filter: {} - replacement: { x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: findAndModify - - commandSucceededEvent: - commandName: findAndModify - - - description: "collection.findOneAndReplace succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: findOneAndReplace - object: *collection - arguments: - filter: {} - replacement: { x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: findAndModify - - commandSucceededEvent: - commandName: findAndModify - - - description: "collection.findOneAndUpdate succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: findOneAndUpdate - object: *collection - arguments: - filter: {} - update: { $set: { x: 22 } } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: findAndModify - - commandSucceededEvent: - commandName: findAndModify - - - description: "collection.findOneAndUpdate succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: findOneAndUpdate - object: *collection - arguments: - filter: {} - update: { $set: { x: 22 } } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: findAndModify - - commandSucceededEvent: - commandName: findAndModify - - - description: "collection.bulkWrite succeeds after retryable handshake network error" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: bulkWrite - object: *collection - arguments: - requests: - - insertOne: - document: { _id: 2, x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: insert - - commandSucceededEvent: - commandName: insert - - - description: "collection.bulkWrite succeeds after retryable handshake server error (ShutdownInProgress)" - operations: - - name: failPoint - object: testRunner - arguments: - client: *client - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: [ping, saslContinue] - closeConnection: true - - name: runCommand - object: *database - arguments: { commandName: ping, command: { ping: 1 } } - expectError: { isError: true } - - name: bulkWrite - object: *collection - arguments: - requests: - - insertOne: - document: { _id: 2, x: 22 } - expectEvents: - - client: *client - eventType: cmap - events: - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - { connectionCheckOutStartedEvent: {} } - - client: *client - events: - - commandStartedEvent: - command: { ping: 1 } - databaseName: *databaseName - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: insert - - commandSucceededEvent: - commandName: insert diff --git a/testdata/server-selection/logging/operation-id.json b/testdata/server-selection/logging/operation-id.json index c1024184ff..72ebff60d8 100644 --- a/testdata/server-selection/logging/operation-id.json +++ b/testdata/server-selection/logging/operation-id.json @@ -345,7 +345,7 @@ } }, { - "name": "bulkWrite", + "name": "clientBulkWrite", "object": "client", "arguments": { "models": [ diff --git a/testdata/server-selection/logging/operation-id.yml b/testdata/server-selection/logging/operation-id.yml index 1687fc392d..e5732893fa 100644 --- a/testdata/server-selection/logging/operation-id.yml +++ b/testdata/server-selection/logging/operation-id.yml @@ -191,7 +191,7 @@ tests: newDescription: type: Unknown count: 1 - - name: bulkWrite + - name: clientBulkWrite object: *client arguments: models: diff --git a/testdata/transactions/unified/mongos-pin-auto.json b/testdata/transactions/unified/mongos-pin-auto.json deleted file mode 100644 index 27db520401..0000000000 --- a/testdata/transactions/unified/mongos-pin-auto.json +++ /dev/null @@ -1,5474 +0,0 @@ -{ - "description": "mongos-pin-auto", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "remain pinned after non-transient Interrupted error on insertOne", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorCodeName": "Interrupted" - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - }, - { - "description": "unpin after transient error within a transaction", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on insertOne insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on insertMany insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on updateOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on replaceOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on updateMany update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on deleteOne delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on deleteMany delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on find find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on countDocuments aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on aggregate aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on distinct distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "session": "session0", - "fieldName": "_id", - "filter": {} - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on runCommand insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "session": "session0", - "commandName": "insert", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on clientBulkWrite bulkWrite", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "bulkWrite" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "clientBulkWrite", - "object": "client0", - "arguments": { - "session": "session0", - "models": [ - { - "insertOne": { - "namespace": "database0.collection0", - "document": { - "_id": 8, - "x": 88 - } - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "runOnRequirements": [ - { - "minServerVersion": "8.0" - } - ] - }, - { - "description": "unpin after transient connection error on insertOne insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on insertOne insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on insertMany insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on insertMany insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on updateOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on updateOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on replaceOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on replaceOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on updateMany update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on updateMany update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on deleteOne delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on deleteOne delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on deleteMany delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on deleteMany delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on findOneAndDelete findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on findOneAndUpdate findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on findOneAndReplace findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on bulkWrite insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on bulkWrite update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on bulkWrite delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on find find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on find find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on countDocuments aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on countDocuments aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on aggregate aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on aggregate aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on distinct distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "closeConnection": true - } - } - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "session": "session0", - "fieldName": "_id", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on distinct distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "session": "session0", - "fieldName": "_id", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on runCommand insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "session": "session0", - "commandName": "insert", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on runCommand insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "session": "session0", - "commandName": "insert", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on clientBulkWrite bulkWrite", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "bulkWrite" - ], - "closeConnection": true - } - } - } - }, - { - "name": "clientBulkWrite", - "object": "client0", - "arguments": { - "session": "session0", - "models": [ - { - "insertOne": { - "namespace": "database0.collection0", - "document": { - "_id": 8, - "x": 88 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "runOnRequirements": [ - { - "minServerVersion": "8.0" - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on clientBulkWrite bulkWrite", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "bulkWrite" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "clientBulkWrite", - "object": "client0", - "arguments": { - "session": "session0", - "models": [ - { - "insertOne": { - "namespace": "database0.collection0", - "document": { - "_id": 8, - "x": 88 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "runOnRequirements": [ - { - "minServerVersion": "8.0" - } - ] - } - ] -} diff --git a/testdata/transactions/unified/mongos-pin-auto.yml b/testdata/transactions/unified/mongos-pin-auto.yml deleted file mode 100644 index db620c371b..0000000000 --- a/testdata/transactions/unified/mongos-pin-auto.yml +++ /dev/null @@ -1,1705 +0,0 @@ -# Autogenerated tests that transient errors in a transaction unpin the session. -# See mongos-pin-auto-tests.py - -description: mongos-pin-auto - -schemaVersion: '1.4' - -runOnRequirements: - - minServerVersion: "4.1.8" - # Note: tests utilize targetedFailPoint, which is incompatible with - # load-balanced and useMultipleMongoses:true - topologies: [ sharded ] - # serverless proxy doesn't append error labels to errors in transactions - # caused by failpoints (CLOUDP-88216) - serverless: "forbid" - -createEntities: - - client: - id: &client0 client0 - useMultipleMongoses: true - observeEvents: [ commandStartedEvent ] - - database: - id: &database0 database0 - client: *client0 - databaseName: &database_name transaction-tests - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collection_name test - - session: - id: &session0 session0 - client: *client0 - -initialData: - - collectionName: *collection_name - databaseName: *database_name - documents: &data - - { _id: 1 } - - { _id: 2 } - -tests: - - description: remain pinned after non-transient Interrupted error on insertOne - operations: - - &startTransaction - object: session0 - name: startTransaction - - &initialCommand - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: { _id: 3 } - expectResult: { $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } } - - object: testRunner - name: targetedFailPoint - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: [ "insert" ] - errorCode: 11601 - - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: { _id: 4 } - expectError: - errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"] - errorCodeName: Interrupted - - &assertSessionPinned - object: testRunner - name: assertSessionPinned - arguments: - session: *session0 - - &commitTransaction - object: *session0 - name: commitTransaction - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 3 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: true - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 4 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - commandStartedEvent: - command: - commitTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - recoveryToken: { $$exists: true } - commandName: commitTransaction - databaseName: admin - outcome: - - collectionName: *collection_name - databaseName: *database_name - documents: - - { _id: 1 } - - { _id: 2 } - - { _id: 3 } - - - description: 'unpin after transient error within a transaction' - operations: - - *startTransaction - - *initialCommand - - object: testRunner - name: targetedFailPoint - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: [ "insert" ] - closeConnection: true - - object: *collection0 - name: insertOne - arguments: - session: *session0 - document: { _id: 4 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - errorLabelsOmit: ["UnknownTransactionCommitResult"] - - &assertSessionUnpinned - object: testRunner - name: assertSessionUnpinned - arguments: - session: *session0 - - &abortTransaction - object: *session0 - name: abortTransaction - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 3 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: true - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - commandStartedEvent: - command: - insert: *collection_name - documents: - - { _id: 4 } - ordered: true - readConcern: { $$exists: false } - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - commandName: insert - databaseName: *database_name - - commandStartedEvent: - command: - abortTransaction: 1 - lsid: { $$sessionLsid: *session0 } - txnNumber: { $numberLong: '1' } - startTransaction: { $$exists: false } - autocommit: false - writeConcern: { $$exists: false } - recoveryToken: { $$exists: true } - commandName: abortTransaction - databaseName: admin - outcome: &outcome - - collectionName: *collection_name - databaseName: *database_name - documents: *data - - # The rest of the tests in this file test every operation type against - # multiple types of transient errors (connection and error code). - - - description: remain pinned after non-transient Interrupted error on insertOne insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: insertOne - object: *collection0 - arguments: - session: *session0 - document: { _id: 4 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on insertMany insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: insertMany - object: *collection0 - arguments: - session: *session0 - documents: [ { _id: 4 }, { _id: 5 } ] - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on updateOne update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: updateOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - update: { $inc: { x: 1 } } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on replaceOne update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: replaceOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - replacement: { y: 1 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on updateMany update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: updateMany - object: *collection0 - arguments: - session: *session0 - filter: { _id: { $gte: 1 } } - update: {$set: { z: 1 } } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on deleteOne delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 11601 - - name: deleteOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on deleteMany delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 11601 - - name: deleteMany - object: *collection0 - arguments: - session: *session0 - filter: { _id: { $gte: 1 } } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 11601 - - name: findOneAndDelete - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 11601 - - name: findOneAndUpdate - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - update: { $inc: { x: 1 } } - returnDocument: Before - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 11601 - - name: findOneAndReplace - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - replacement: { y: 1 } - returnDocument: Before - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on bulkWrite insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - insertOne: - document: { _id: 1 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on bulkWrite update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 11601 - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - updateOne: - filter: { _id: 1 } - update: { $set: { x: 1 } } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on bulkWrite delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 11601 - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - deleteOne: - filter: { _id: 1 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on find find - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["find"] - errorCode: 11601 - - name: find - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on countDocuments aggregate - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 11601 - - name: countDocuments - object: *collection0 - arguments: - session: *session0 - filter: {} - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on aggregate aggregate - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 11601 - - name: aggregate - object: *collection0 - arguments: - session: *session0 - pipeline: [] - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on distinct distinct - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["distinct"] - errorCode: 11601 - - name: distinct - object: *collection0 - arguments: - session: *session0 - fieldName: _id - filter: {} - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on runCommand insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 11601 - - name: runCommand - object: *database0 - arguments: - session: *session0 - commandName: insert - command: - insert: *collection_name - documents: - - { _id : 1 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - - - description: remain pinned after non-transient Interrupted error on clientBulkWrite bulkWrite - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["bulkWrite"] - errorCode: 11601 - - name: clientBulkWrite - object: *client0 - arguments: - session: *session0 - models: - - insertOne: - namespace: database0.collection0 - document: { _id: 8, x: 88 } - expectError: - errorLabelsOmit: ["TransientTransactionError"] - - *assertSessionPinned - - *abortTransaction - outcome: *outcome - runOnRequirements: - - minServerVersion: "8.0" # `bulkWrite` added to server 8.0" - - - description: unpin after transient connection error on insertOne insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: insertOne - object: *collection0 - arguments: - session: *session0 - document: { _id: 4 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on insertOne insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: insertOne - object: *collection0 - arguments: - session: *session0 - document: { _id: 4 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on insertMany insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: insertMany - object: *collection0 - arguments: - session: *session0 - documents: [ { _id: 4 }, { _id: 5 } ] - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on insertMany insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: insertMany - object: *collection0 - arguments: - session: *session0 - documents: [ { _id: 4 }, { _id: 5 } ] - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on updateOne update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: updateOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - update: { $inc: { x: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on updateOne update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: updateOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - update: { $inc: { x: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on replaceOne update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: replaceOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - replacement: { y: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on replaceOne update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: replaceOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - replacement: { y: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on updateMany update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: updateMany - object: *collection0 - arguments: - session: *session0 - filter: { _id: { $gte: 1 } } - update: {$set: { z: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on updateMany update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: updateMany - object: *collection0 - arguments: - session: *session0 - filter: { _id: { $gte: 1 } } - update: {$set: { z: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on deleteOne delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - closeConnection: true - - name: deleteOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on deleteOne delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 91 - - name: deleteOne - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on deleteMany delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - closeConnection: true - - name: deleteMany - object: *collection0 - arguments: - session: *session0 - filter: { _id: { $gte: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on deleteMany delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 91 - - name: deleteMany - object: *collection0 - arguments: - session: *session0 - filter: { _id: { $gte: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on findOneAndDelete findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - closeConnection: true - - name: findOneAndDelete - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 91 - - name: findOneAndDelete - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on findOneAndUpdate findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - closeConnection: true - - name: findOneAndUpdate - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - update: { $inc: { x: 1 } } - returnDocument: Before - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 91 - - name: findOneAndUpdate - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - update: { $inc: { x: 1 } } - returnDocument: Before - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on findOneAndReplace findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - closeConnection: true - - name: findOneAndReplace - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - replacement: { y: 1 } - returnDocument: Before - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["findAndModify"] - errorCode: 91 - - name: findOneAndReplace - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - replacement: { y: 1 } - returnDocument: Before - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on bulkWrite insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - insertOne: - document: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on bulkWrite insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - insertOne: - document: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on bulkWrite update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - closeConnection: true - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - updateOne: - filter: { _id: 1 } - update: { $set: { x: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on bulkWrite update - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["update"] - errorCode: 91 - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - updateOne: - filter: { _id: 1 } - update: { $set: { x: 1 } } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on bulkWrite delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - closeConnection: true - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - deleteOne: - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on bulkWrite delete - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["delete"] - errorCode: 91 - - name: bulkWrite - object: *collection0 - arguments: - session: *session0 - requests: - - deleteOne: - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on find find - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["find"] - closeConnection: true - - name: find - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on find find - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["find"] - errorCode: 91 - - name: find - object: *collection0 - arguments: - session: *session0 - filter: { _id: 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on countDocuments aggregate - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - closeConnection: true - - name: countDocuments - object: *collection0 - arguments: - session: *session0 - filter: {} - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on countDocuments aggregate - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 91 - - name: countDocuments - object: *collection0 - arguments: - session: *session0 - filter: {} - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on aggregate aggregate - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - closeConnection: true - - name: aggregate - object: *collection0 - arguments: - session: *session0 - pipeline: [] - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on aggregate aggregate - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["aggregate"] - errorCode: 91 - - name: aggregate - object: *collection0 - arguments: - session: *session0 - pipeline: [] - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on distinct distinct - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["distinct"] - closeConnection: true - - name: distinct - object: *collection0 - arguments: - session: *session0 - fieldName: _id - filter: {} - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on distinct distinct - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["distinct"] - errorCode: 91 - - name: distinct - object: *collection0 - arguments: - session: *session0 - fieldName: _id - filter: {} - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on runCommand insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - closeConnection: true - - name: runCommand - object: *database0 - arguments: - session: *session0 - commandName: insert - command: - insert: *collection_name - documents: - - { _id : 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient ShutdownInProgress error on runCommand insert - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["insert"] - errorCode: 91 - - name: runCommand - object: *database0 - arguments: - session: *session0 - commandName: insert - command: - insert: *collection_name - documents: - - { _id : 1 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - - - description: unpin after transient connection error on clientBulkWrite bulkWrite - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["bulkWrite"] - closeConnection: true - - name: clientBulkWrite - object: *client0 - arguments: - session: *session0 - models: - - insertOne: - namespace: database0.collection0 - document: { _id: 8, x: 88 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - runOnRequirements: - - minServerVersion: "8.0" # `bulkWrite` added to server 8.0" - - - description: unpin after transient ShutdownInProgress error on clientBulkWrite bulkWrite - operations: - - *startTransaction - - *initialCommand - - name: targetedFailPoint - object: testRunner - arguments: - session: *session0 - failPoint: - configureFailPoint: failCommand - mode: {times: 1} - data: - failCommands: ["bulkWrite"] - errorCode: 91 - - name: clientBulkWrite - object: *client0 - arguments: - session: *session0 - models: - - insertOne: - namespace: database0.collection0 - document: { _id: 8, x: 88 } - expectError: - errorLabelsContain: ["TransientTransactionError"] - - *assertSessionUnpinned - - *abortTransaction - outcome: *outcome - runOnRequirements: - - minServerVersion: "8.0" # `bulkWrite` added to server 8.0" diff --git a/testdata/versioned-api/crud-api-version-1.json b/testdata/versioned-api/crud-api-version-1.json index a387d0587e..23ef59a6d9 100644 --- a/testdata/versioned-api/crud-api-version-1.json +++ b/testdata/versioned-api/crud-api-version-1.json @@ -50,7 +50,8 @@ }, "apiDeprecationErrors": true } - ] + ], + "namespace": "versioned-api-tests.test" }, "initialData": [ { @@ -426,6 +427,86 @@ } ] }, + { + "description": "client bulkWrite appends declared API version", + "runOnRequirements": [ + { + "minServerVersion": "8.0", + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "clientBulkWrite", + "object": "client", + "arguments": { + "models": [ + { + "insertOne": { + "namespace": "versioned-api-tests.test", + "document": { + "_id": 6, + "x": 6 + } + } + } + ], + "verboseResults": true + }, + "expectResult": { + "insertedCount": 1, + "upsertedCount": 0, + "matchedCount": 0, + "modifiedCount": 0, + "deletedCount": 0, + "insertResults": { + "0": { + "insertedId": 6 + } + }, + "updateResults": {}, + "deleteResults": {} + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ + { + "commandStartedEvent": { + "commandName": "bulkWrite", + "databaseName": "admin", + "command": { + "bulkWrite": 1, + "errorsOnly": false, + "ordered": true, + "ops": [ + { + "insert": 0, + "document": { + "_id": 6, + "x": 6 + } + } + ], + "nsInfo": [ + { + "ns": "versioned-api-tests.test" + } + ], + "apiVersion": "1", + "apiStrict": { + "$$unsetOrMatches": false + }, + "apiDeprecationErrors": true + } + } + } + ] + } + ] + }, { "description": "countDocuments appends declared API version", "operations": [ diff --git a/testdata/versioned-api/crud-api-version-1.yml b/testdata/versioned-api/crud-api-version-1.yml index 50135c1458..01e0323420 100644 --- a/testdata/versioned-api/crud-api-version-1.yml +++ b/testdata/versioned-api/crud-api-version-1.yml @@ -34,6 +34,7 @@ _yamlAnchors: apiVersion: "1" apiStrict: { $$unsetOrMatches: false } apiDeprecationErrors: true + namespace: &namespace "versioned-api-tests.test" initialData: - collectionName: *collectionName @@ -155,6 +156,47 @@ tests: multi: { $$unsetOrMatches: false } upsert: true <<: *expectedApiVersion + + - description: "client bulkWrite appends declared API version" + runOnRequirements: + - minServerVersion: "8.0" # `bulkWrite` added to server 8.0 + serverless: forbid + operations: + - name: clientBulkWrite + object: *client + arguments: + models: + - insertOne: + namespace: *namespace + document: { _id: 6, x: 6 } + verboseResults: true + expectResult: + insertedCount: 1 + upsertedCount: 0 + matchedCount: 0 + modifiedCount: 0 + deletedCount: 0 + insertResults: + 0: + insertedId: 6 + updateResults: {} + deleteResults: {} + expectEvents: + - client: *client + events: + - commandStartedEvent: + commandName: bulkWrite + databaseName: admin + command: + bulkWrite: 1 + errorsOnly: false + ordered: true + ops: + - insert: 0 + document: { _id: 6, x: 6 } + nsInfo: + - { ns: *namespace } + <<: *expectedApiVersion - description: "countDocuments appends declared API version" operations: diff --git a/x/mongo/driver/operation/command.go b/x/mongo/driver/operation/command.go index 443120d130..82845f1d0b 100644 --- a/x/mongo/driver/operation/command.go +++ b/x/mongo/driver/operation/command.go @@ -23,6 +23,7 @@ import ( // Command is used to run a generic operation. type Command struct { + name string authenticator driver.Authenticator commandFn func([]byte, description.SelectedServer) ([]byte, error) batches *driver.Batches @@ -123,6 +124,7 @@ func (c *Command) Execute(ctx context.Context) error { Timeout: c.timeout, Logger: c.logger, Authenticator: c.authenticator, + Name: c.name, }.Execute(ctx) } @@ -265,3 +267,13 @@ func (c *Command) Authenticator(authenticator driver.Authenticator) *Command { c.authenticator = authenticator return c } + +// Name sets the name for this operation. +func (c *Command) Name(name string) *Command { + if c == nil { + c = new(Command) + } + + c.name = name + return c +}