From 2d53d6ae8d3cb61fb7dea0e3d2d3087e4fce0e8f Mon Sep 17 00:00:00 2001 From: Preston Vasquez <24281431+prestonvasquez@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:05:27 -0700 Subject: [PATCH] GODRIVER-2348 Deprecate socketTimeoutMS --- internal/integration/client_test.go | 2 +- internal/integration/errors_test.go | 55 +- internal/integration/json_helpers_test.go | 8 +- .../integration/sdam_error_handling_test.go | 110 +- internal/integration/unified/client_entity.go | 4 +- mongo/client.go | 3 + mongo/client_test.go | 9 + mongo/options/clientoptions.go | 46 +- mongo/options/clientoptions_test.go | 6 - .../retryability-legacy-timeouts.json | 3042 ----------------- .../retryability-legacy-timeouts.yml | 1676 --------- x/mongo/driver/topology/connection.go | 5 - x/mongo/driver/topology/server.go | 34 +- x/mongo/driver/topology/server_test.go | 59 +- x/mongo/driver/topology/topology_options.go | 18 +- 15 files changed, 182 insertions(+), 4895 deletions(-) delete mode 100644 testdata/client-side-operations-timeout/retryability-legacy-timeouts.json delete mode 100644 testdata/client-side-operations-timeout/retryability-legacy-timeouts.yml diff --git a/internal/integration/client_test.go b/internal/integration/client_test.go index 8350db58e0..3ac0128001 100644 --- a/internal/integration/client_test.go +++ b/internal/integration/client_test.go @@ -327,7 +327,7 @@ func TestClient(t *testing.T) { // apply the correct URI. invalidClientOpts := options.Client(). SetServerSelectionTimeout(100 * time.Millisecond).SetHosts([]string{"invalid:123"}). - SetConnectTimeout(500 * time.Millisecond).SetSocketTimeout(500 * time.Millisecond) + SetConnectTimeout(500 * time.Millisecond).SetTimeout(500 * time.Millisecond) integtest.AddTestServerAPIVersion(invalidClientOpts) client, err := mongo.Connect(invalidClientOpts) assert.Nil(mt, err, "Connect error: %v", err) diff --git a/internal/integration/errors_test.go b/internal/integration/errors_test.go index 8c6c0fb812..3ba64c6054 100644 --- a/internal/integration/errors_test.go +++ b/internal/integration/errors_test.go @@ -104,32 +104,35 @@ func TestErrors(t *testing.T) { "errors.Is failure: expected error %v to be %v", err, context.DeadlineExceeded) }) - mt.Run("socketTimeoutMS timeouts return network errors", func(mt *mtest.T) { - _, err := mt.Coll.InsertOne(context.Background(), bson.D{{"x", 1}}) - assert.Nil(mt, err, "InsertOne error: %v", err) - - // Reset the test client to have a 100ms socket timeout. We do this here rather than passing it in as a - // test option using mt.RunOpts because that could cause the collection creation or InsertOne to fail. - resetClientOpts := options.Client(). - SetSocketTimeout(100 * time.Millisecond) - mt.ResetClient(resetClientOpts) - - mt.ClearEvents() - filter := bson.M{ - "$where": "function() { sleep(1000); return false; }", - } - _, err = mt.Coll.Find(context.Background(), filter) - - evt := mt.GetStartedEvent() - assert.Equal(mt, "find", evt.CommandName, "expected command 'find', got %q", evt.CommandName) - - assert.False(mt, errors.Is(err, context.DeadlineExceeded), - "errors.Is failure: expected error %v to not be %v", err, context.DeadlineExceeded) - var netErr net.Error - ok := errors.As(err, &netErr) - assert.True(mt, ok, "errors.As failure: expected error %v to be a net.Error", err) - assert.True(mt, netErr.Timeout(), "expected error %v to be a network timeout", err) - }) + // TODO(GODRIVER-2348): Can we remove this / update it to be specific to + // timeoutMS instead of socketTimeoutMS? + //mt.Run("socketTimeoutMS timeouts return network errors", func(mt *mtest.T) { + // _, err := mt.Coll.InsertOne(context.Background(), bson.D{{"x", 1}}) + // assert.Nil(mt, err, "InsertOne error: %v", err) + + // // Reset the test client to have a 100ms timeout. We do this here rather than passing it in as a + // // test option using mt.RunOpts because that could cause the collection creation or InsertOne to fail. + // resetClientOpts := options.Client().SetTimeout(100 * time.Millisecond) + // mt.ResetClient(resetClientOpts) + + // mt.ClearEvents() + // filter := bson.M{ + // "$where": "function() { sleep(1000); return false; }", + // } + // _, err = mt.Coll.Find(context.Background(), filter) + + // fmt.Println("err: ", err) + + // evt := mt.GetStartedEvent() + // assert.Equal(mt, "find", evt.CommandName, "expected command 'find', got %q", evt.CommandName) + + // assert.False(mt, errors.Is(err, context.DeadlineExceeded), + // "errors.Is failure: expected error %v to not be %v", err, context.DeadlineExceeded) + // var netErr net.Error + // ok := errors.As(err, &netErr) + // assert.True(mt, ok, "errors.As failure: expected error %v to be a net.Error", err) + // assert.True(mt, netErr.Timeout(), "expected error %v to be a network timeout", err) + //}) }) mt.Run("ServerError", func(mt *mtest.T) { matchWrapped := errors.New("wrapped err") diff --git a/internal/integration/json_helpers_test.go b/internal/integration/json_helpers_test.go index c6d171b6a6..7395548483 100644 --- a/internal/integration/json_helpers_test.go +++ b/internal/integration/json_helpers_test.go @@ -110,9 +110,11 @@ func createClientOptions(t testing.TB, opts bson.Raw) *options.ClientOptions { case "serverSelectionTimeoutMS": sst := convertValueToMilliseconds(t, opt) clientOpts.SetServerSelectionTimeout(sst) - case "socketTimeoutMS": - st := convertValueToMilliseconds(t, opt) - clientOpts.SetSocketTimeout(st) + // TODO(GODRIVER-2348): How are we supposed to handle socketTimeoutMS once + // deprecated? + //case "socketTimeoutMS": + // st := convertValueToMilliseconds(t, opt) + // clientOpts.SetSocketTimeout(st) case "minPoolSize": clientOpts.SetMinPoolSize(uint64(opt.AsInt64())) case "maxPoolSize": diff --git a/internal/integration/sdam_error_handling_test.go b/internal/integration/sdam_error_handling_test.go index 8b96069476..8b1b0e1aca 100644 --- a/internal/integration/sdam_error_handling_test.go +++ b/internal/integration/sdam_error_handling_test.go @@ -49,60 +49,62 @@ func TestSDAMErrorHandling(t *testing.T) { // blockConnection and appName. mt.RunOpts("before handshake completes", baseMtOpts().Auth(true).MinServerVersion("4.4"), func(mt *mtest.T) { mt.RunOpts("network errors", noClientOpts, func(mt *mtest.T) { - mt.Run("pool cleared on network timeout", func(mt *mtest.T) { - // Assert that the pool is cleared when a connection created by an application - // operation thread encounters a timeout caused by socketTimeoutMS during - // handshaking. - - appName := "authConnectTimeoutTest" - // Set failpoint on saslContinue instead of saslStart because saslStart isn't done when using - // speculative auth. - mt.SetFailPoint(mtest.FailPoint{ - ConfigureFailPoint: "failCommand", - Mode: mtest.FailPointMode{ - Times: 1, - }, - Data: mtest.FailPointData{ - FailCommands: []string{"saslContinue"}, - BlockConnection: true, - BlockTimeMS: 150, - AppName: appName, - }, - }) - - // Reset the client with the appName specified in the failpoint and the pool monitor. - tpm := eventtest.NewTestPoolMonitor() - mt.ResetClient(baseClientOpts(). - SetAppName(appName). - SetPoolMonitor(tpm.PoolMonitor). - // Set a 100ms socket timeout so that the saslContinue delay of 150ms causes a - // timeout during socket read (i.e. a timeout not caused by the InsertOne context). - SetSocketTimeout(100 * time.Millisecond)) - - // Use context.Background() so that the new connection will not time out due to an - // operation-scoped timeout. - _, err := mt.Coll.InsertOne(context.Background(), bson.D{{"test", 1}}) - assert.NotNil(mt, err, "expected InsertOne error, got nil") - assert.True(mt, mongo.IsTimeout(err), "expected timeout error, got %v", err) - assert.True(mt, mongo.IsNetworkError(err), "expected network error, got %v", err) - // Assert that the pool is cleared within 2 seconds. - assert.Soon(mt, func(ctx context.Context) { - ticker := time.NewTicker(100 * time.Millisecond) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - case <-ctx.Done(): - return - } - - if tpm.IsPoolCleared() { - return - } - } - }, 2*time.Second) - }) + // TODO(GODRIVER-2348): Can we remove this / update it to be specific to + // timeoutMS instead of socketTimeoutMS? + //mt.Run("pool cleared on network timeout", func(mt *mtest.T) { + // // Assert that the pool is cleared when a connection created by an application + // // operation thread encounters a timeout caused by socketTimeoutMS during + // // handshaking. + + // appName := "authConnectTimeoutTest" + // // Set failpoint on saslContinue instead of saslStart because saslStart isn't done when using + // // speculative auth. + // mt.SetFailPoint(mtest.FailPoint{ + // ConfigureFailPoint: "failCommand", + // Mode: mtest.FailPointMode{ + // Times: 1, + // }, + // Data: mtest.FailPointData{ + // FailCommands: []string{"saslContinue"}, + // BlockConnection: true, + // BlockTimeMS: 150, + // AppName: appName, + // }, + // }) + + // // Reset the client with the appName specified in the failpoint and the pool monitor. + // tpm := eventtest.NewTestPoolMonitor() + // mt.ResetClient(baseClientOpts(). + // SetAppName(appName). + // SetPoolMonitor(tpm.PoolMonitor). + // // Set a 100ms socket timeout so that the saslContinue delay of 150ms causes a + // // timeout during socket read (i.e. a timeout not caused by the InsertOne context). + // SetTimeout(100 * time.Millisecond)) + + // // Use context.Background() so that the new connection will not time out due to an + // // operation-scoped timeout. + // _, err := mt.Coll.InsertOne(context.Background(), bson.D{{"test", 1}}) + // assert.NotNil(mt, err, "expected InsertOne error, got nil") + // assert.True(mt, mongo.IsTimeout(err), "expected timeout error, got %v", err) + // assert.True(mt, mongo.IsNetworkError(err), "expected network error, got %v", err) + // // Assert that the pool is cleared within 2 seconds. + // assert.Soon(mt, func(ctx context.Context) { + // ticker := time.NewTicker(100 * time.Millisecond) + // defer ticker.Stop() + + // for { + // select { + // case <-ticker.C: + // case <-ctx.Done(): + // return + // } + + // if tpm.IsPoolCleared() { + // return + // } + // } + // }, 2*time.Second) + //}) mt.RunOpts("pool cleared on non-timeout network error", noClientOpts, func(mt *mtest.T) { mt.Run("background", func(mt *mtest.T) { diff --git a/internal/integration/unified/client_entity.go b/internal/integration/unified/client_entity.go index 2d4c87b94b..70b96c8351 100644 --- a/internal/integration/unified/client_entity.go +++ b/internal/integration/unified/client_entity.go @@ -611,8 +611,10 @@ func setClientOptionsFromURIOptions(clientOpts *options.ClientOptions, uriOpts b clientOpts.SetRetryReads(value.(bool)) case "retrywrites": clientOpts.SetRetryWrites(value.(bool)) + // TODO(GODRIVER-2348): How are we supposed to handle socketTimeoutMS once + // deprecated? case "sockettimeoutms": - clientOpts.SetSocketTimeout(time.Duration(value.(int32)) * time.Millisecond) + clientOpts.SetTimeout(time.Duration(value.(int32)) * time.Millisecond) case "w": wc.W = value wcSet = true diff --git a/mongo/client.go b/mongo/client.go index 2d26b0db7a..c4e759a1c4 100644 --- a/mongo/client.go +++ b/mongo/client.go @@ -181,6 +181,9 @@ func newClient(opts ...*options.ClientOptions) (*Client, error) { client.retryReads = *clientOpt.RetryReads } // Timeout + if to := clientOpt.Timeout; to != nil && *to < 0 { + return nil, fmt.Errorf("invalid value for \"timeout\": %q", *to) + } client.timeout = clientOpt.Timeout client.httpClient = clientOpt.HTTPClient // WriteConcern diff --git a/mongo/client_test.go b/mongo/client_test.go index ddba3062fe..b2becf593c 100644 --- a/mongo/client_test.go +++ b/mongo/client_test.go @@ -501,4 +501,13 @@ func TestClient(t *testing.T) { }) } }) + t.Run("negative timeout will err", func(t *testing.T) { + t.Parallel() + + copts := options.Client().SetTimeout(-1 * time.Second) + _, err := Connect(copts) + + errmsg := `invalid value for "timeout": "-1s"` + assert.Equal(t, errmsg, err.Error(), "expected error %v, got %v", errmsg, err.Error()) + }) } diff --git a/mongo/options/clientoptions.go b/mongo/options/clientoptions.go index 9677ef75b0..1ba04228b2 100644 --- a/mongo/options/clientoptions.go +++ b/mongo/options/clientoptions.go @@ -252,13 +252,6 @@ type ClientOptions struct { // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any // release. Deployment driver.Deployment - - // SocketTimeout specifies the timeout to be used for the Client's socket reads and writes. - // - // NOTE(benjirewis): SocketTimeout will be deprecated in a future release. The more general Timeout option - // may be used in its place to control the amount of time that a single operation can run before returning - // an error. Setting SocketTimeout and Timeout on a single client will result in undefined behavior. - SocketTimeout *time.Duration } // Client creates a new ClientOptions instance. @@ -477,10 +470,6 @@ func (c *ClientOptions) ApplyURI(uri string) *ClientOptions { c.ServerSelectionTimeout = &cs.ServerSelectionTimeout } - if cs.SocketTimeoutSet { - c.SocketTimeout = &cs.SocketTimeout - } - if cs.SRVMaxHosts != 0 { c.SRVMaxHosts = &cs.SRVMaxHosts } @@ -830,29 +819,19 @@ func (c *ClientOptions) SetServerSelectionTimeout(d time.Duration) *ClientOption return c } -// SetSocketTimeout specifies how long the driver will wait for a socket read or write to return before returning a -// network error. This can also be set through the "socketTimeoutMS" URI option (e.g. "socketTimeoutMS=1000"). The -// default value is 0, meaning no timeout is used and socket operations can block indefinitely. +// SetTimeout specifies the amount of time that a single operation run on this +// Client can execute before returning an error. The deadline of any operation +// run through the Client will be honored above any Timeout set on the Client; +// Timeout will only be honored if there is no deadline on the operation +// Context. Timeout can also be set through the "timeoutMS" URI option +// (e.g. "timeoutMS=1000"). The default value is nil, meaning operations do not +// inherit a timeout from the Client. // -// NOTE(benjirewis): SocketTimeout will be deprecated in a future release. The more general Timeout option may be used -// in its place to control the amount of time that a single operation can run before returning an error. Setting -// SocketTimeout and Timeout on a single client will result in undefined behavior. -func (c *ClientOptions) SetSocketTimeout(d time.Duration) *ClientOptions { - c.SocketTimeout = &d - return c -} - -// SetTimeout specifies the amount of time that a single operation run on this Client can execute before returning an error. -// The deadline of any operation run through the Client will be honored above any Timeout set on the Client; Timeout will only -// be honored if there is no deadline on the operation Context. Timeout can also be set through the "timeoutMS" URI option -// (e.g. "timeoutMS=1000"). The default value is nil, meaning operations do not inherit a timeout from the Client. +// The value for a Timeout must be positive. // -// If any Timeout is set (even 0) on the Client, the values of MaxTime on operation options, TransactionOptions.MaxCommitTime and -// SessionOptions.DefaultMaxCommitTime will be ignored. Setting Timeout and SocketTimeout or WriteConcern.wTimeout will result -// in undefined behavior. -// -// NOTE(benjirewis): SetTimeout represents unstable, provisional API. The behavior of the driver when a Timeout is specified is -// subject to change. +// If any Timeout is set (even 0) on the Client, the values of MaxTime on +// operation options, TransactionOptions.MaxCommitTime and +// SessionOptions.DefaultMaxCommitTime will be ignored. func (c *ClientOptions) SetTimeout(d time.Duration) *ClientOptions { c.Timeout = &d return c @@ -1087,9 +1066,6 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions { if opt.Direct != nil { c.Direct = opt.Direct } - if opt.SocketTimeout != nil { - c.SocketTimeout = opt.SocketTimeout - } if opt.SRVMaxHosts != nil { c.SRVMaxHosts = opt.SRVMaxHosts } diff --git a/mongo/options/clientoptions_test.go b/mongo/options/clientoptions_test.go index d3f29ad774..91d6572165 100644 --- a/mongo/options/clientoptions_test.go +++ b/mongo/options/clientoptions_test.go @@ -86,7 +86,6 @@ func TestClientOptions(t *testing.T) { {"RetryWrites", (*ClientOptions).SetRetryWrites, true, "RetryWrites", true}, {"ServerSelectionTimeout", (*ClientOptions).SetServerSelectionTimeout, 5 * time.Second, "ServerSelectionTimeout", true}, {"Direct", (*ClientOptions).SetDirect, true, "Direct", true}, - {"SocketTimeout", (*ClientOptions).SetSocketTimeout, 5 * time.Second, "SocketTimeout", true}, {"TLSConfig", (*ClientOptions).SetTLSConfig, &tls.Config{}, "TLSConfig", false}, {"WriteConcern", (*ClientOptions).SetWriteConcern, writeconcern.Majority(), "WriteConcern", false}, {"ZlibLevel", (*ClientOptions).SetZlibLevel, 6, "ZlibLevel", true}, @@ -401,11 +400,6 @@ func TestClientOptions(t *testing.T) { "mongodb://localhost/?serverSelectionTimeoutMS=45000", baseClient().SetServerSelectionTimeout(45 * time.Second), }, - { - "SocketTimeout", - "mongodb://localhost/?socketTimeoutMS=15000", - baseClient().SetSocketTimeout(15 * time.Second), - }, { "TLS CACertificate", "mongodb://localhost/?ssl=true&sslCertificateAuthorityFile=testdata/ca.pem", diff --git a/testdata/client-side-operations-timeout/retryability-legacy-timeouts.json b/testdata/client-side-operations-timeout/retryability-legacy-timeouts.json deleted file mode 100644 index 6cf1f4ce6e..0000000000 --- a/testdata/client-side-operations-timeout/retryability-legacy-timeouts.json +++ /dev/null @@ -1,3042 +0,0 @@ -{ - "description": "legacy timeouts behave correctly for retryable operations", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.4", - "topologies": [ - "replicaset", - "sharded-replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "failPointClient", - "useMultipleMongoses": false - } - }, - { - "client": { - "id": "client", - "uriOptions": { - "socketTimeoutMS": 100 - }, - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "test", - "documents": [] - } - ], - "tests": [ - { - "description": "operation succeeds after one socket timeout - insertOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - insertOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "x": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - insertMany on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "x": 1 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - insertMany on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "x": 1 - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - deleteOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "delete", - "databaseName": "test", - "command": { - "delete": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "delete", - "databaseName": "test", - "command": { - "delete": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - deleteOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "delete" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "delete", - "databaseName": "test", - "command": { - "delete": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "delete", - "databaseName": "test", - "command": { - "delete": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - replaceOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - replaceOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "update" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - updateOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - updateOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "update" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 1 - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "update", - "databaseName": "test", - "command": { - "update": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - findOneAndDelete on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - findOneAndDelete on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - findOneAndReplace on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - findOneAndReplace on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - findOneAndUpdate on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - findOneAndUpdate on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 1 - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify", - "databaseName": "test", - "command": { - "findAndModify": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - bulkWrite on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - bulkWrite on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "insert", - "databaseName": "test", - "command": { - "insert": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - listDatabases on client", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listDatabases", - "object": "client", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - listDatabases on client", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listDatabases", - "object": "client", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - listDatabaseNames on client", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listDatabaseNames", - "object": "client" - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - listDatabaseNames on client", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listDatabaseNames", - "object": "client", - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases", - "databaseName": "admin", - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - createChangeStream on client", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "createChangeStream", - "object": "client", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "admin", - "command": { - "aggregate": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "admin", - "command": { - "aggregate": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - createChangeStream on client", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "createChangeStream", - "object": "client", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "admin", - "command": { - "aggregate": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "admin", - "command": { - "aggregate": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - aggregate on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "aggregate", - "object": "database", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - aggregate on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "aggregate", - "object": "database", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - listCollections on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listCollections", - "object": "database", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - listCollections on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listCollections", - "object": "database", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - listCollectionNames on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listCollectionNames", - "object": "database", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - listCollectionNames on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listCollectionNames", - "object": "database", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections", - "databaseName": "test", - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - createChangeStream on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "createChangeStream", - "object": "database", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - createChangeStream on database", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "createChangeStream", - "object": "database", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": 1 - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - aggregate on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - aggregate on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - count on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "count", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - count on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "count" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "count", - "object": "collection", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - countDocuments on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - countDocuments on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - estimatedDocumentCount on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "estimatedDocumentCount", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - estimatedDocumentCount on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "count" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "estimatedDocumentCount", - "object": "collection", - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "count", - "databaseName": "test", - "command": { - "count": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - distinct on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "x", - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "distinct", - "databaseName": "test", - "command": { - "distinct": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "distinct", - "databaseName": "test", - "command": { - "distinct": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - distinct on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "distinct" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "x", - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "distinct", - "databaseName": "test", - "command": { - "distinct": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "distinct", - "databaseName": "test", - "command": { - "distinct": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - find on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - find on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - findOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - findOne on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "findOne", - "object": "collection", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "test", - "command": { - "find": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - listIndexes on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listIndexes", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listIndexes", - "databaseName": "test", - "command": { - "listIndexes": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes", - "databaseName": "test", - "command": { - "listIndexes": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - listIndexes on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "listIndexes", - "object": "collection", - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "listIndexes", - "databaseName": "test", - "command": { - "listIndexes": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes", - "databaseName": "test", - "command": { - "listIndexes": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation succeeds after one socket timeout - createChangeStream on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - } - ] - } - ] - }, - { - "description": "operation fails after two consecutive socket timeouts - createChangeStream on collection", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "blockConnection": true, - "blockTimeMS": 110 - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate", - "databaseName": "test", - "command": { - "aggregate": "coll" - } - } - } - ] - } - ] - } - ] -} diff --git a/testdata/client-side-operations-timeout/retryability-legacy-timeouts.yml b/testdata/client-side-operations-timeout/retryability-legacy-timeouts.yml deleted file mode 100644 index de3eb9971d..0000000000 --- a/testdata/client-side-operations-timeout/retryability-legacy-timeouts.yml +++ /dev/null @@ -1,1676 +0,0 @@ -# Tests in this file are generated from retryability-legacy-timeouts.yml.template. - -description: "legacy timeouts behave correctly for retryable operations" - -schemaVersion: "1.9" - -runOnRequirements: - - minServerVersion: "4.4" - topologies: ["replicaset", "sharded-replicaset"] - -createEntities: - - client: - id: &failPointClient failPointClient - useMultipleMongoses: false - - client: - id: &client client - uriOptions: - socketTimeoutMS: 100 - useMultipleMongoses: false - observeEvents: - - commandStartedEvent - ignoreCommandMonitoringEvents: - - killCursors - - database: - id: &database database - client: *client - databaseName: &databaseName test - - collection: - id: &collection collection - database: *database - collectionName: &collectionName coll - -initialData: - - collectionName: *collectionName - databaseName: *databaseName - documents: [] - -tests: - # For each retryable operation, run two tests: - # - # 1. Socket timeouts are retried once - Each test constructs a client entity with socketTimeoutMS=50, configures a - # fail point to block the operation once for 110ms, and expects the operation to succeed. - # - # 2. Operations fail after two consecutive socket timeouts - Same as (1) but the fail point is configured to block - # the operation twice and the test expects the operation to fail. - - - description: "operation succeeds after one socket timeout - insertOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - blockConnection: true - blockTimeMS: 110 - - name: insertOne - object: *collection - arguments: - document: { x: 1 } - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - description: "operation fails after two consecutive socket timeouts - insertOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["insert"] - blockConnection: true - blockTimeMS: 110 - - name: insertOne - object: *collection - arguments: - document: { x: 1 } - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - description: "operation succeeds after one socket timeout - insertMany on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - blockConnection: true - blockTimeMS: 110 - - name: insertMany - object: *collection - arguments: - documents: - - { x: 1 } - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - description: "operation fails after two consecutive socket timeouts - insertMany on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["insert"] - blockConnection: true - blockTimeMS: 110 - - name: insertMany - object: *collection - arguments: - documents: - - { x: 1 } - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - description: "operation succeeds after one socket timeout - deleteOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["delete"] - blockConnection: true - blockTimeMS: 110 - - name: deleteOne - object: *collection - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: delete - databaseName: *databaseName - command: - delete: *collectionName - - commandStartedEvent: - commandName: delete - databaseName: *databaseName - command: - delete: *collectionName - - description: "operation fails after two consecutive socket timeouts - deleteOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["delete"] - blockConnection: true - blockTimeMS: 110 - - name: deleteOne - object: *collection - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: delete - databaseName: *databaseName - command: - delete: *collectionName - - commandStartedEvent: - commandName: delete - databaseName: *databaseName - command: - delete: *collectionName - - description: "operation succeeds after one socket timeout - replaceOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["update"] - blockConnection: true - blockTimeMS: 110 - - name: replaceOne - object: *collection - arguments: - filter: {} - replacement: { x: 1 } - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - description: "operation fails after two consecutive socket timeouts - replaceOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["update"] - blockConnection: true - blockTimeMS: 110 - - name: replaceOne - object: *collection - arguments: - filter: {} - replacement: { x: 1 } - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - description: "operation succeeds after one socket timeout - updateOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["update"] - blockConnection: true - blockTimeMS: 110 - - name: updateOne - object: *collection - arguments: - filter: {} - update: { $set: { x: 1 } } - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - description: "operation fails after two consecutive socket timeouts - updateOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["update"] - blockConnection: true - blockTimeMS: 110 - - name: updateOne - object: *collection - arguments: - filter: {} - update: { $set: { x: 1 } } - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - commandStartedEvent: - commandName: update - databaseName: *databaseName - command: - update: *collectionName - - description: "operation succeeds after one socket timeout - findOneAndDelete on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["findAndModify"] - blockConnection: true - blockTimeMS: 110 - - name: findOneAndDelete - object: *collection - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - description: "operation fails after two consecutive socket timeouts - findOneAndDelete on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["findAndModify"] - blockConnection: true - blockTimeMS: 110 - - name: findOneAndDelete - object: *collection - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - description: "operation succeeds after one socket timeout - findOneAndReplace on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["findAndModify"] - blockConnection: true - blockTimeMS: 110 - - name: findOneAndReplace - object: *collection - arguments: - filter: {} - replacement: { x: 1 } - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - description: "operation fails after two consecutive socket timeouts - findOneAndReplace on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["findAndModify"] - blockConnection: true - blockTimeMS: 110 - - name: findOneAndReplace - object: *collection - arguments: - filter: {} - replacement: { x: 1 } - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - description: "operation succeeds after one socket timeout - findOneAndUpdate on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["findAndModify"] - blockConnection: true - blockTimeMS: 110 - - name: findOneAndUpdate - object: *collection - arguments: - filter: {} - update: { $set: { x: 1 } } - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - description: "operation fails after two consecutive socket timeouts - findOneAndUpdate on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["findAndModify"] - blockConnection: true - blockTimeMS: 110 - - name: findOneAndUpdate - object: *collection - arguments: - filter: {} - update: { $set: { x: 1 } } - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - commandStartedEvent: - commandName: findAndModify - databaseName: *databaseName - command: - findAndModify: *collectionName - - description: "operation succeeds after one socket timeout - bulkWrite on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["insert"] - blockConnection: true - blockTimeMS: 110 - - name: bulkWrite - object: *collection - arguments: - requests: - - insertOne: - document: { _id: 1 } - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - description: "operation fails after two consecutive socket timeouts - bulkWrite on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["insert"] - blockConnection: true - blockTimeMS: 110 - - name: bulkWrite - object: *collection - arguments: - requests: - - insertOne: - document: { _id: 1 } - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - commandStartedEvent: - commandName: insert - databaseName: *databaseName - command: - insert: *collectionName - - description: "operation succeeds after one socket timeout - listDatabases on client" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["listDatabases"] - blockConnection: true - blockTimeMS: 110 - - name: listDatabases - object: *client - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - description: "operation fails after two consecutive socket timeouts - listDatabases on client" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["listDatabases"] - blockConnection: true - blockTimeMS: 110 - - name: listDatabases - object: *client - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - description: "operation succeeds after one socket timeout - listDatabaseNames on client" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["listDatabases"] - blockConnection: true - blockTimeMS: 110 - - name: listDatabaseNames - object: *client - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - description: "operation fails after two consecutive socket timeouts - listDatabaseNames on client" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["listDatabases"] - blockConnection: true - blockTimeMS: 110 - - name: listDatabaseNames - object: *client - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - commandStartedEvent: - commandName: listDatabases - databaseName: admin - command: - listDatabases: 1 - - description: "operation succeeds after one socket timeout - createChangeStream on client" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: createChangeStream - object: *client - arguments: - pipeline: [] - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: admin - command: - aggregate: 1 - - commandStartedEvent: - commandName: aggregate - databaseName: admin - command: - aggregate: 1 - - description: "operation fails after two consecutive socket timeouts - createChangeStream on client" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: createChangeStream - object: *client - arguments: - pipeline: [] - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: admin - command: - aggregate: 1 - - commandStartedEvent: - commandName: aggregate - databaseName: admin - command: - aggregate: 1 - - description: "operation succeeds after one socket timeout - aggregate on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: aggregate - object: *database - arguments: - pipeline: [ { $listLocalSessions: {} }, { $limit: 1 } ] - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - description: "operation fails after two consecutive socket timeouts - aggregate on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: aggregate - object: *database - arguments: - pipeline: [ { $listLocalSessions: {} }, { $limit: 1 } ] - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - description: "operation succeeds after one socket timeout - listCollections on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["listCollections"] - blockConnection: true - blockTimeMS: 110 - - name: listCollections - object: *database - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - description: "operation fails after two consecutive socket timeouts - listCollections on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["listCollections"] - blockConnection: true - blockTimeMS: 110 - - name: listCollections - object: *database - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - description: "operation succeeds after one socket timeout - listCollectionNames on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["listCollections"] - blockConnection: true - blockTimeMS: 110 - - name: listCollectionNames - object: *database - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - description: "operation fails after two consecutive socket timeouts - listCollectionNames on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["listCollections"] - blockConnection: true - blockTimeMS: 110 - - name: listCollectionNames - object: *database - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - commandStartedEvent: - commandName: listCollections - databaseName: *databaseName - command: - listCollections: 1 - - description: "operation succeeds after one socket timeout - createChangeStream on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: createChangeStream - object: *database - arguments: - pipeline: [] - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - description: "operation fails after two consecutive socket timeouts - createChangeStream on database" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: createChangeStream - object: *database - arguments: - pipeline: [] - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: 1 - - description: "operation succeeds after one socket timeout - aggregate on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: aggregate - object: *collection - arguments: - pipeline: [] - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - description: "operation fails after two consecutive socket timeouts - aggregate on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: aggregate - object: *collection - arguments: - pipeline: [] - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - description: "operation succeeds after one socket timeout - count on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["count"] - blockConnection: true - blockTimeMS: 110 - - name: count - object: *collection - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - description: "operation fails after two consecutive socket timeouts - count on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["count"] - blockConnection: true - blockTimeMS: 110 - - name: count - object: *collection - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - description: "operation succeeds after one socket timeout - countDocuments on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: countDocuments - object: *collection - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - description: "operation fails after two consecutive socket timeouts - countDocuments on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: countDocuments - object: *collection - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - description: "operation succeeds after one socket timeout - estimatedDocumentCount on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["count"] - blockConnection: true - blockTimeMS: 110 - - name: estimatedDocumentCount - object: *collection - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - description: "operation fails after two consecutive socket timeouts - estimatedDocumentCount on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["count"] - blockConnection: true - blockTimeMS: 110 - - name: estimatedDocumentCount - object: *collection - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - commandStartedEvent: - commandName: count - databaseName: *databaseName - command: - count: *collectionName - - description: "operation succeeds after one socket timeout - distinct on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["distinct"] - blockConnection: true - blockTimeMS: 110 - - name: distinct - object: *collection - arguments: - fieldName: x - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: distinct - databaseName: *databaseName - command: - distinct: *collectionName - - commandStartedEvent: - commandName: distinct - databaseName: *databaseName - command: - distinct: *collectionName - - description: "operation fails after two consecutive socket timeouts - distinct on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["distinct"] - blockConnection: true - blockTimeMS: 110 - - name: distinct - object: *collection - arguments: - fieldName: x - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: distinct - databaseName: *databaseName - command: - distinct: *collectionName - - commandStartedEvent: - commandName: distinct - databaseName: *databaseName - command: - distinct: *collectionName - - description: "operation succeeds after one socket timeout - find on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["find"] - blockConnection: true - blockTimeMS: 110 - - name: find - object: *collection - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - description: "operation fails after two consecutive socket timeouts - find on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["find"] - blockConnection: true - blockTimeMS: 110 - - name: find - object: *collection - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - description: "operation succeeds after one socket timeout - findOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["find"] - blockConnection: true - blockTimeMS: 110 - - name: findOne - object: *collection - arguments: - filter: {} - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - description: "operation fails after two consecutive socket timeouts - findOne on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["find"] - blockConnection: true - blockTimeMS: 110 - - name: findOne - object: *collection - arguments: - filter: {} - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - commandStartedEvent: - commandName: find - databaseName: *databaseName - command: - find: *collectionName - - description: "operation succeeds after one socket timeout - listIndexes on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["listIndexes"] - blockConnection: true - blockTimeMS: 110 - - name: listIndexes - object: *collection - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listIndexes - databaseName: *databaseName - command: - listIndexes: *collectionName - - commandStartedEvent: - commandName: listIndexes - databaseName: *databaseName - command: - listIndexes: *collectionName - - description: "operation fails after two consecutive socket timeouts - listIndexes on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["listIndexes"] - blockConnection: true - blockTimeMS: 110 - - name: listIndexes - object: *collection - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: listIndexes - databaseName: *databaseName - command: - listIndexes: *collectionName - - commandStartedEvent: - commandName: listIndexes - databaseName: *databaseName - command: - listIndexes: *collectionName - - description: "operation succeeds after one socket timeout - createChangeStream on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 1 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: createChangeStream - object: *collection - arguments: - pipeline: [] - - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - description: "operation fails after two consecutive socket timeouts - createChangeStream on collection" - operations: - - name: failPoint - object: testRunner - arguments: - client: *failPointClient - failPoint: - configureFailPoint: failCommand - mode: { times: 2 } - data: - failCommands: ["aggregate"] - blockConnection: true - blockTimeMS: 110 - - name: createChangeStream - object: *collection - arguments: - pipeline: [] - - expectError: - # Network errors are considered client errors by the unified test format spec. - isClientError: true - expectEvents: - - client: *client - events: - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - - commandStartedEvent: - commandName: aggregate - databaseName: *databaseName - command: - aggregate: *collectionName - diff --git a/x/mongo/driver/topology/connection.go b/x/mongo/driver/topology/connection.go index 4abad98e8d..a0d1a1c198 100644 --- a/x/mongo/driver/topology/connection.go +++ b/x/mongo/driver/topology/connection.go @@ -523,11 +523,6 @@ func (c *connection) getCurrentlyStreaming() bool { return c.currentlyStreaming } -func (c *connection) setSocketTimeout(timeout time.Duration) { - c.readTimeout = timeout - c.writeTimeout = timeout -} - func (c *connection) ID() string { return c.id } diff --git a/x/mongo/driver/topology/server.go b/x/mongo/driver/topology/server.go index 893aefa83d..8586c64dd8 100644 --- a/x/mongo/driver/topology/server.go +++ b/x/mongo/driver/topology/server.go @@ -606,6 +606,11 @@ func (s *Server) update() { performCheck := func() (description.Server, error) { // Create a context for the blocking operations associated with checking the // status of a server. + // + // The Server Monitoring spec already mandates that drivers set and + // dynamically update the read/write timeout of the dedicated connections + // used in monitoring threads, so we rely on that to time out commands + // rather than adding complexity to the behavior of timeoutMS. ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Release context resources for the check. @@ -767,9 +772,11 @@ func (s *Server) updateDescription(desc description.Server) { func (s *Server) createConnection() *connection { opts := copyConnectionOpts(s.cfg.connectionOpts) opts = append(opts, - // TODO(GODRIVER-2348): Deprecate this logic - WithReadTimeout(func(time.Duration) time.Duration { return 10 * time.Second }), - WithWriteTimeout(func(time.Duration) time.Duration { return 10 * time.Second }), + // TODO(GODRIVER-2348): Should we be setting a read/write timeout? If so, + // what should the value be? Do we still want this data to be set at the + // topology level? + //WithReadTimeout(func(time.Duration) time.Duration { return 10 * time.Second }), + //WithWriteTimeout(func(time.Duration) time.Duration { return 10 * time.Second }), // We override whatever handshaker is currently attached to the options with a basic // one because need to make sure we don't do auth. WithHandshaker(func(h Handshaker) Handshaker { @@ -926,22 +933,29 @@ func (s *Server) check(ctx context.Context) (description.Server, error) { // Calculation for maxAwaitTimeMS is taken from time.Duration.Milliseconds (added in Go 1.13). maxAwaitTimeMS := int64(s.cfg.heartbeatInterval) / 1e6 + // If connectTimeoutMS=0, the socket timeout should be infinite. Otherwise, it is connectTimeoutMS + // heartbeatFrequencyMS to account for the fact that the query will block for heartbeatFrequencyMS // server-side. - socketTimeout := s.cfg.connectTimeout - if socketTimeout != 0 { - socketTimeout += s.cfg.heartbeatInterval + rwTimeout := s.cfg.connectTimeout + if rwTimeout != 0 { + rwTimeout += s.cfg.heartbeatInterval } - s.conn.setSocketTimeout(socketTimeout) + + s.conn.readTimeout = rwTimeout + s.conn.writeTimeout = rwTimeout + baseOperation = baseOperation.TopologyVersion(previousDescription.TopologyVersion). MaxAwaitTimeMS(maxAwaitTimeMS) s.conn.setCanStream(true) err = baseOperation.Execute(ctx) // HERE default: - // The server doesn't support the awaitable protocol. Set the socket timeout to connectTimeoutMS and - // execute a regular heartbeat without any additional parameters. - s.conn.setSocketTimeout(s.cfg.connectTimeout) + // The server doesn't support the awaitable protocol. Set the RW timeout + // to connectTimeoutMS and execute a regular heartbeat without any + // additional parameters. + s.conn.readTimeout = s.cfg.connectTimeout + s.conn.writeTimeout = s.cfg.connectTimeout + err = baseOperation.Execute(ctx) // HERE } diff --git a/x/mongo/driver/topology/server_test.go b/x/mongo/driver/topology/server_test.go index 5f4a2196d0..96072aa69d 100644 --- a/x/mongo/driver/topology/server_test.go +++ b/x/mongo/driver/topology/server_test.go @@ -806,35 +806,38 @@ func TestServer(t *testing.T) { WithServerAppName(func(string) string { return name })) require.Equal(t, name, s.cfg.appname, "expected appname to be: %v, got: %v", name, s.cfg.appname) }) - t.Run("createConnection overwrites WithSocketTimeout", func(t *testing.T) { - socketTimeout := 40 * time.Second - connectTimeout := 10 * time.Second - s := NewServer( - address.Address("localhost"), - primitive.NewObjectID(), - connectTimeout, - WithConnectionOptions(func(connOpts ...ConnectionOption) []ConnectionOption { - return append( - connOpts, - WithReadTimeout(func(time.Duration) time.Duration { return socketTimeout }), - WithWriteTimeout(func(time.Duration) time.Duration { return socketTimeout }), - ) - }), - ) - - conn := s.createConnection() - assert.Equal(t, s.cfg.connectTimeout, 10*time.Second, - "expected heartbeatTimeout to be: %v, got: %v", 10*time.Second, s.cfg.connectTimeout) - - // TODO(GODRIVER-2348): The following two tests might be removed when - // feature-gating CSOT - assert.Equal(t, s.cfg.connectTimeout, conn.readTimeout, - "expected readTimeout to be: %v, got: %v", s.cfg.connectTimeout, conn.readTimeout) - - assert.Equal(t, s.cfg.connectTimeout, conn.writeTimeout, - "expected writeTimeout to be: %v, got: %v", s.cfg.connectTimeout, conn.writeTimeout) - }) + // TODO(GODRIVER-2348): Can we remove this / update it to be specific to + // timeoutMS instead of socketTimeoutMS? + //t.Run("createConnection overwrites WithSocketTimeout", func(t *testing.T) { + // socketTimeout := 40 * time.Second + // connectTimeout := 10 * time.Second + + // s := NewServer( + // address.Address("localhost"), + // primitive.NewObjectID(), + // connectTimeout, + // WithConnectionOptions(func(connOpts ...ConnectionOption) []ConnectionOption { + // return append( + // connOpts, + // WithReadTimeout(func(time.Duration) time.Duration { return socketTimeout }), + // WithWriteTimeout(func(time.Duration) time.Duration { return socketTimeout }), + // ) + // }), + // ) + + // conn := s.createConnection() + // assert.Equal(t, s.cfg.connectTimeout, 10*time.Second, + // "expected heartbeatTimeout to be: %v, got: %v", 10*time.Second, s.cfg.connectTimeout) + + // // TODO(GODRIVER-2348): The following two tests might be removed when + // // feature-gating CSOT + // assert.Equal(t, s.cfg.connectTimeout, conn.readTimeout, + // "expected readTimeout to be: %v, got: %v", s.cfg.connectTimeout, conn.readTimeout) + + // assert.Equal(t, s.cfg.connectTimeout, conn.writeTimeout, + // "expected writeTimeout to be: %v, got: %v", s.cfg.connectTimeout, conn.writeTimeout) + //}) } func TestServer_ProcessError(t *testing.T) { diff --git a/x/mongo/driver/topology/topology_options.go b/x/mongo/driver/topology/topology_options.go index 743dac1bed..2d3a129fcd 100644 --- a/x/mongo/driver/topology/topology_options.go +++ b/x/mongo/driver/topology/topology_options.go @@ -293,14 +293,16 @@ func NewConfig(co *options.ClientOptions, clock *session.ClusterClock) (*Config, if co.ConnectTimeout != nil { cfgp.ConnectTimeout = *co.ConnectTimeout } - // SocketTimeout - if co.SocketTimeout != nil { - connOpts = append( - connOpts, - WithReadTimeout(func(time.Duration) time.Duration { return *co.SocketTimeout }), - WithWriteTimeout(func(time.Duration) time.Duration { return *co.SocketTimeout }), - ) - } + // TODO(GODRIVER-2348): Should we be setting a read/write timeout? If so, + // what should the value be? Do we still want this data to be set at the + // topology level? + //if co.Timeout != nil { + // connOpts = append( + // connOpts, + // WithReadTimeout(func(time.Duration) time.Duration { return *co.Timeout }), + // WithWriteTimeout(func(time.Duration) time.Duration { return *co.Timeout }), + // ) + //} // TLSConfig if co.TLSConfig != nil { connOpts = append(connOpts, WithTLSConfig(