diff --git a/src/connection_string.ts b/src/connection_string.ts index 376cce51d37..c56cf9bdedd 100644 --- a/src/connection_string.ts +++ b/src/connection_string.ts @@ -643,7 +643,7 @@ interface OptionDescriptor { } export const OPTIONS = { - adaptiveRetries: { + enableOverloadRetargeting: { default: false, type: 'boolean' }, @@ -885,6 +885,10 @@ export const OPTIONS = { default: 15, type: 'uint' }, + maxAdaptiveRetries: { + default: 2, + type: 'uint' + }, maxConnecting: { default: 2, transform({ name, values: [value] }): number { diff --git a/src/index.ts b/src/index.ts index 883a6c53916..74803dfa2a0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -621,7 +621,6 @@ export type { TimeoutContext, TimeoutContextOptions } from './timeout'; -export type { MAX_RETRIES, TokenBucket } from './token_bucket'; export type { Transaction, TransactionOptions, TxnState } from './transactions'; export type { BufferPool, diff --git a/src/mongo_client.ts b/src/mongo_client.ts index e8a5f6158d2..181f1fedacb 100644 --- a/src/mongo_client.ts +++ b/src/mongo_client.ts @@ -229,8 +229,10 @@ export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeC retryReads?: boolean; /** Enable retryable writes. */ retryWrites?: boolean; - /** Whether to enable adaptive retry rate limiting using a token bucket. Defaults to false. */ - adaptiveRetries?: boolean; + /** The maximum number of retries for overload errors. Set to 0 to disable overload retries. Defaults to 2. */ + maxAdaptiveRetries?: number; + /** Whether to deprioritize servers that return overload errors during retry server selection. Defaults to false. */ + enableOverloadRetargeting?: boolean; /** Allow a driver to force a Single topology type with a connection string containing one host */ directConnection?: boolean; /** Instruct the driver it is connecting to a load balancer fronting a mongos like service */ @@ -1043,7 +1045,8 @@ export interface MongoOptions extends Required< Pick< MongoClientOptions, - | 'adaptiveRetries' + | 'maxAdaptiveRetries' + | 'enableOverloadRetargeting' | 'autoEncryption' | 'connectTimeoutMS' | 'directConnection' diff --git a/src/operations/execute_operation.ts b/src/operations/execute_operation.ts index 0715a5f0704..64ce92d52b2 100644 --- a/src/operations/execute_operation.ts +++ b/src/operations/execute_operation.ts @@ -29,13 +29,6 @@ import { import type { Topology } from '../sdam/topology'; import type { ClientSession } from '../sessions'; import { TimeoutContext } from '../timeout'; -import { - BASE_BACKOFF_MS, - MAX_BACKOFF_MS, - MAX_RETRIES, - RETRY_COST, - RETRY_TOKEN_RETURN_RATE -} from '../token_bucket'; import { abortable, maxWireVersion, supportsRetryableWrites } from '../utils'; import { AggregateOperation } from './aggregate'; import { AbstractOperation, Aspect } from './operation'; @@ -176,6 +169,10 @@ type RetryOptions = { topology: Topology; timeoutContext: TimeoutContext; }; +/** @internal The base backoff duration in milliseconds */ +const BASE_BACKOFF_MS = 100; +/** @internal The maximum backoff duration in milliseconds */ +const MAX_BACKOFF_MS = 10_000; /** * Executes an operation and retries as appropriate @@ -267,13 +264,6 @@ async function executeOperationWithRetries< try { try { const result = await server.command(operation, timeoutContext); - if (topology.s.options.adaptiveRetries) { - topology.tokenBucket.deposit( - attempt > 0 - ? RETRY_TOKEN_RETURN_RATE + RETRY_COST // on successful retry - : RETRY_TOKEN_RETURN_RATE // otherwise - ); - } return operation.handleOk(result); } catch (error) { return operation.handleError(error); @@ -282,15 +272,6 @@ async function executeOperationWithRetries< // Should never happen but if it does - propagate the error. if (!(operationError instanceof MongoError)) throw operationError; - if ( - topology.s.options.adaptiveRetries && - attempt > 0 && - !operationError.hasErrorLabel(MongoErrorLabel.SystemOverloadedError) - ) { - // if a retry attempt fails with a non-overload error, deposit 1 token. - topology.tokenBucket.deposit(RETRY_COST); - } - // Preserve the original error once a write has been performed. // Only update to the latest error if no writes were performed. if (error == null) { @@ -317,7 +298,8 @@ async function executeOperationWithRetries< } if (operationError.hasErrorLabel(MongoErrorLabel.SystemOverloadedError)) { - maxAttempts = Math.min(MAX_RETRIES + 1, operation.maxAttempts ?? MAX_RETRIES + 1); + const maxOverloadAttempts = topology.s.options.maxAdaptiveRetries + 1; + maxAttempts = Math.min(maxOverloadAttempts, operation.maxAttempts ?? maxOverloadAttempts); } if (attempt + 1 >= maxAttempts) { @@ -352,16 +334,13 @@ async function executeOperationWithRetries< throw error; } - if (topology.s.options.adaptiveRetries && !topology.tokenBucket.consume(RETRY_COST)) { - throw error; - } - await setTimeout(backoffMS); } if ( topology.description.type === TopologyType.Sharded || - operationError.hasErrorLabel(MongoErrorLabel.SystemOverloadedError) + (operationError.hasErrorLabel(MongoErrorLabel.SystemOverloadedError) && + topology.s.options.enableOverloadRetargeting) ) { deprioritizedServers.add(server.description); } diff --git a/src/sdam/topology.ts b/src/sdam/topology.ts index 8ed4899f9b6..abfeb555539 100644 --- a/src/sdam/topology.ts +++ b/src/sdam/topology.ts @@ -35,7 +35,6 @@ import { type Abortable, TypedEventEmitter } from '../mongo_types'; import { ReadPreference, type ReadPreferenceLike } from '../read_preference'; import type { ClientSession } from '../sessions'; import { Timeout, TimeoutContext, TimeoutError } from '../timeout'; -import { INITIAL_TOKEN_BUCKET_SIZE, TokenBucket } from '../token_bucket'; import type { Transaction } from '../transactions'; import { addAbortListener, @@ -146,7 +145,8 @@ export interface TopologyOptions extends BSONSerializeOptions, ServerOptions { hosts: HostAddress[]; retryWrites: boolean; retryReads: boolean; - adaptiveRetries: boolean; + maxAdaptiveRetries: number; + enableOverloadRetargeting: boolean; /** How long to block for server selection before throwing an error */ serverSelectionTimeoutMS: number; /** The name of the replica set to connect to */ @@ -214,8 +214,6 @@ export class Topology extends TypedEventEmitter { hello?: Document; _type?: string; - tokenBucket = new TokenBucket(INITIAL_TOKEN_BUCKET_SIZE); - client!: MongoClient; private connectionLock?: Promise; diff --git a/src/sessions.ts b/src/sessions.ts index ea209b63d10..812b4aecdb0 100644 --- a/src/sessions.ts +++ b/src/sessions.ts @@ -30,7 +30,6 @@ import { ReadConcernLevel } from './read_concern'; import { ReadPreference } from './read_preference'; import { _advanceClusterTime, type ClusterTime, TopologyType } from './sdam/common'; import { TimeoutContext } from './timeout'; -import { MAX_RETRIES } from './token_bucket'; import { isTransactionCommand, Transaction, @@ -498,7 +497,7 @@ export class ClientSession readPreference: ReadPreference.primary, bypassPinningCheck: true }); - operation.maxAttempts = MAX_RETRIES + 1; + operation.maxAttempts = this.clientOptions.maxAdaptiveRetries + 1; const timeoutContext = this.timeoutContext ?? @@ -517,7 +516,7 @@ export class ClientSession } catch (firstCommitError) { this.commitAttempted = true; - const remainingAttempts = MAX_RETRIES + 1 - operation.attemptsMade; + const remainingAttempts = this.clientOptions.maxAdaptiveRetries + 1 - operation.attemptsMade; if (remainingAttempts <= 0) { throw firstCommitError; } diff --git a/src/token_bucket.ts b/src/token_bucket.ts deleted file mode 100644 index 434b847cc6f..00000000000 --- a/src/token_bucket.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @internal - */ -export class TokenBucket { - private budget: number; - private capacity: number; - - constructor(allowance: number) { - this.budget = allowance; - this.capacity = allowance; - } - - deposit(tokens: number) { - this.budget = Math.min(this.budget + tokens, this.capacity); - } - - consume(tokens: number): boolean { - if (tokens > this.budget) return false; - - this.budget -= tokens; - return true; - } -} - -/** - * @internal - * The amount to deposit on successful operations, as defined in the backpressure specification. - */ -export const RETRY_TOKEN_RETURN_RATE = 0.1; -/** - * @internal - * The initial size of the token bucket, as defined in the backpressure specification. - */ -export const INITIAL_TOKEN_BUCKET_SIZE = 1_000; -/** - * @internal - * The cost of a retry, as defined in the backpressure specification. - */ -export const RETRY_COST = 1; -/** - * @internal - * The maximum number of retries for overload errors - * */ -export const MAX_RETRIES = 5; -/** - * @internal - * The base backoff duration in milliseconds - * */ -export const BASE_BACKOFF_MS = 100; -/** - * @internal - * The maximum backoff duration in milliseconds - * */ -export const MAX_BACKOFF_MS = 10_000; diff --git a/test/integration/client-backpressure/client-backpressure.prose.test.ts b/test/integration/client-backpressure/client-backpressure.prose.test.ts index ce25a5be695..16eb4f58d3d 100644 --- a/test/integration/client-backpressure/client-backpressure.prose.test.ts +++ b/test/integration/client-backpressure/client-backpressure.prose.test.ts @@ -1,12 +1,7 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { - INITIAL_TOKEN_BUCKET_SIZE, - MAX_RETRIES, - type MongoClient, - MongoServerError -} from '../../mongodb'; +import { type MongoClient, MongoServerError } from '../../mongodb'; import { clearFailPoint, configureFailPoint, measureDuration } from '../../tools/utils'; import { filterForCommands } from '../shared'; @@ -36,22 +31,11 @@ describe('Client Backpressure (Prose)', function () { const collection = client.db('foo').collection('bar'); // 3. Now, run transactions without backoff: - // i. Configure the random number generator used for jitter to always return `0` -- this effectively disables backoff. + // i. Configure the random number generator used for jitter to always return `0` const stub = sinon.stub(Math, 'random'); stub.returns(0); // ii. Configure the following failPoint: - // ```javascript - // { - // configureFailPoint: 'failCommand', - // mode: 'alwaysOn', - // data: { - // failCommands: ['insert'], - // errorCode: 2, - // errorLabels: ['SystemOverloadedError', 'RetryableError'] - // } - // } - // ``` await configureFailPoint(this.configuration, { configureFailPoint: 'failCommand', mode: 'alwaysOn', @@ -62,7 +46,7 @@ describe('Client Backpressure (Prose)', function () { } }); - // iii. Insert the document `{ a: 1 }`. Expect that the command errors. Measure the duration of the command execution. + // iii. Insert the document `{ a: 1 }`. Expect that the command errors. const { duration: durationNoBackoff } = await measureDuration(async () => { const error = await collection.insertOne({ a: 1 }).catch(e => e); expect(error).to.be.instanceof(MongoServerError); @@ -77,31 +61,12 @@ describe('Client Backpressure (Prose)', function () { expect(error).to.be.instanceof(MongoServerError); }); - // vi. Compare the two time between the two runs. - // The sum of 5 backoffs is 3.1 seconds. There is a 1-second window to account for potential variance between the two runs. - expect(durationBackoff - durationNoBackoff).to.be.within(3100 - 1000, 3100 + 1000); + // vi. Compare the time between the two runs. + // The sum of 2 backoffs is 0.3 seconds. There is a 0.3-second window to account for potential variance. + expect(durationBackoff - durationNoBackoff).to.be.within(300 - 300, 300 + 300); } ); - it('Test 2: Token Bucket capacity is Enforced', async function () { - // 1. Let client be a MongoClient with adaptiveRetries=True. - client = this.configuration.newClient({ - adaptiveRetries: true - }); - await client.connect(); - - // 2. Assert that the client's retry token bucket is at full capacity and that the capacity is DEFAULT_RETRY_TOKEN_CAPACITY. - const tokenBucket = client.topology.tokenBucket; - expect(tokenBucket).to.have.property('budget', INITIAL_TOKEN_BUCKET_SIZE); - expect(tokenBucket).to.have.property('capacity', INITIAL_TOKEN_BUCKET_SIZE); - - // 3. Using client, execute a successful ping command. - await client.db('admin').command({ ping: 1 }); - - // 4. Assert that the successful command did not increase the number of tokens in the bucket above DEFAULT_RETRY_TOKEN_CAPACITY. - expect(tokenBucket).to.have.property('budget').that.is.at.most(INITIAL_TOKEN_BUCKET_SIZE); - }); - it( 'Test 3: Overload Errors are Retried a Maximum of MAX_RETRIES times', { @@ -121,18 +86,7 @@ describe('Client Backpressure (Prose)', function () { const commandsStarted = []; client.on('commandStarted', filterForCommands(['find'], commandsStarted)); - /* - * 3. Configure the following failpoint: - { - configureFailPoint: 'failCommand', - mode: 'alwaysOn', - data: { - failCommands: ['find'], - errorCode: 462, // IngressRequestRateLimitExceeded - errorLabels: ['SystemOverloadedError', 'RetryableError'] - } - } - * */ + // 3. Configure the following failpoint: await configureFailPoint(this.configuration, { configureFailPoint: 'failCommand', mode: 'alwaysOn', @@ -151,50 +105,35 @@ describe('Client Backpressure (Prose)', function () { expect(error.hasErrorLabel('RetryableError')).to.be.true; expect(error.hasErrorLabel('SystemOverloadedError')).to.be.true; - // 6. Assert that the total number of started commands is MAX_RETRIES + 1 (6). - expect(commandsStarted).to.have.length(MAX_RETRIES + 1); + // 6. Assert that the total number of started commands is MAX_RETRIES + 1 (3). + expect(commandsStarted).to.have.length(3); } ); it( - 'Test 4: Adaptive Retries are Limited by Token Bucket Tokens', + 'Test 4: Overload Errors are Retried a Maximum of maxAdaptiveRetries times when configured', { requires: { mongodb: '>=4.4' } }, async function () { - // 1. Let `client` be a `MongoClient` with `adaptiveRetries=True` and command event monitoring enabled. + // 1. Let `client` be a `MongoClient` with `maxAdaptiveRetries=1` and command event monitoring enabled. client = this.configuration.newClient({ - adaptiveRetries: true, + maxAdaptiveRetries: 1, monitorCommands: true }); await client.connect(); - // 2. Set `client`'s retry token bucket to have 2 tokens. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - client.topology!.tokenBucket['budget'] = 2; - - // 3. Let `coll` be a collection. + // 2. Let `coll` be a collection. const collection = client.db('foo').collection('bar'); const commandsStarted = []; client.on('commandStarted', filterForCommands(['find'], commandsStarted)); - /* - * 4. Configure the following failpoint: - { - configureFailPoint: 'failCommand', - mode: {times: 3}, - data: { - failCommands: ['find'], - errorCode: 462, // IngressRequestRateLimitExceeded - errorLabels: ['SystemOverloadedError', 'RetryableError'] - } - } - * */ + // 3. Configure the following failpoint: await configureFailPoint(this.configuration, { configureFailPoint: 'failCommand', - mode: { times: 3 }, + mode: 'alwaysOn', data: { failCommands: ['find'], errorCode: 462, @@ -202,16 +141,16 @@ describe('Client Backpressure (Prose)', function () { } }); - // 5. Perform a find operation with `coll` that fails. + // 4. Perform a find operation with `coll` that fails. const error = await collection.findOne({}).catch(e => e); - // 6. Assert that the raised error contains both the `RetryableError` and `SystemOverloadedError` error labels. + // 5. Assert that the raised error contains both the `RetryableError` and `SystemOverloadedError` error labels. expect(error).to.be.instanceof(MongoServerError); expect(error.hasErrorLabel('RetryableError')).to.be.true; expect(error.hasErrorLabel('SystemOverloadedError')).to.be.true; - // 7. Assert that the total number of started commands is 3: one for the initial attempt and two for the retries. - expect(commandsStarted).to.have.length(3); + // 6. Assert that the total number of started commands is `maxAdaptiveRetries` + 1 (2). + expect(commandsStarted).to.have.length(2); } ); }); diff --git a/test/integration/client-backpressure/client-backpressure.spec.test.ts b/test/integration/client-backpressure/client-backpressure.spec.test.ts index d3c2bd6e9b2..9da13c22747 100644 --- a/test/integration/client-backpressure/client-backpressure.spec.test.ts +++ b/test/integration/client-backpressure/client-backpressure.spec.test.ts @@ -3,7 +3,7 @@ import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; import { type Test } from '../../tools/unified-spec-runner/schema'; const skippedTests = { - 'collection.dropIndexes retries at most maxAttempts=5 times': + 'collection.dropIndexes retries at most maxAttempts=2 times': 'TODO(NODE-6517): dropIndexes squashes all errors other than ns not found', 'collection.dropIndexes (write) does not retry if retryWrites=false': 'TODO(NODE-6517): dropIndexes squashes all errors other than ns not found' diff --git a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts index ac63ad24704..d45b3c45015 100644 --- a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts +++ b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts @@ -151,17 +151,18 @@ describe('Retryable Reads Spec Prose', () => { requires: { mongodb: '>=4.4', topology: 'replicaset' } }; - describe('Retryable Reads Caused by Overload Errors Are Retried on a Different Server', () => { + describe('Retryable Reads Caused by Overload Errors Are Retried on a Different Server When enableOverloadRetargeting is enabled', () => { let client: MongoClient; const commandFailedEvents: CommandFailedEvent[] = []; const commandSucceededEvents: CommandSucceededEvent[] = []; beforeEach(async function () { - // 1. Create a client `client` with `retryReads=true`, `readPreference=primaryPreferred`, and command event monitoring - // enabled. + // 1. Create a client `client` with `retryReads=true`, `readPreference=primaryPreferred`, + // `enableOverloadRetargeting=true`, and command event monitoring enabled. client = this.configuration.newClient({ retryReads: true, readPreference: 'primaryPreferred', + enableOverloadRetargeting: true, monitorCommands: true }); @@ -278,5 +279,73 @@ describe('Retryable Reads Spec Prose', () => { expect(commandFailedEvents[0].address).to.equal(commandSucceededEvents[0].address); }); }); + + describe('Retryable Reads Caused by Overload Errors Are Retried on Same Server When enableOverloadRetargeting is disabled', () => { + let client: MongoClient; + const commandFailedEvents: CommandFailedEvent[] = []; + const commandSucceededEvents: CommandSucceededEvent[] = []; + + beforeEach(async function () { + // 1. Create a client `client` with `retryReads=true`, `readPreference=primaryPreferred`, and command event monitoring + // enabled. + client = this.configuration.newClient({ + retryReads: true, + readPreference: 'primaryPreferred', + monitorCommands: true + }); + + client.on('commandFailed', filterForCommands('find', commandFailedEvents)); + client.on('commandSucceeded', filterForCommands('find', commandSucceededEvents)); + + await client.connect(); + + /* + * 2. Configure the following fail point for `client`: + { + configureFailPoint: "failCommand", + mode: { times: 1 }, + data: { + failCommands: ["find"], + errorLabels: ["RetryableError", "SystemOverloadedError"] + errorCode: 6 + } + } + * */ + await client.db('admin').command({ + configureFailPoint: 'failCommand', + mode: { times: 1 }, + data: { + failCommands: ['find'], + errorCode: 6, + errorLabels: ['RetryableError', 'SystemOverloadedError'] + } + }); + + // 3. Reset the command event monitor to clear the failpoint command from its stored events. + commandFailedEvents.length = 0; + commandSucceededEvents.length = 0; + }); + + afterEach(async function () { + await client?.db('admin').command({ configureFailPoint: 'failCommand', mode: 'off' }); + await client?.close(); + }); + + it( + 'retries on the same server when SystemOverloadedError and enableOverloadRetargeting is disabled', + TEST_METADATA, + async () => { + // 4. Execute a `find` command with `client`. + await client.db('test').collection('test').find().toArray(); + + // 5. Assert that one failed command event and one successful command event occurred. + expect(commandFailedEvents).to.have.lengthOf(1); + expect(commandSucceededEvents).to.have.lengthOf(1); + + // 6. Assert that both events occurred on the same server. + expect(commandFailedEvents[0].address).to.equal(commandSucceededEvents[0].address); + } + ); + }); }); }); diff --git a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts index 5f60712a1d9..0d108b071b1 100644 --- a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts +++ b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts @@ -479,7 +479,8 @@ describe('Retryable Writes Spec Prose', () => { // server error. Assert that the error code of the server error is 91. const insertResult = await collection.insertOne({ _id: 1 }).catch(error => error); - expect(serverCommandStub.callCount).to.equal(6); + // maxAdaptiveRetries defaults to 2, so we expect 3 total attempts (1 initial + 2 retries). + expect(serverCommandStub.callCount).to.equal(3); expect(insertResult).to.be.instanceOf(MongoServerError); expect(insertResult).to.have.property('code', 91); diff --git a/test/mongodb_all.ts b/test/mongodb_all.ts index 16beb26c902..d98518f6f34 100644 --- a/test/mongodb_all.ts +++ b/test/mongodb_all.ts @@ -128,7 +128,6 @@ export * from '../src/sdam/topology_description'; export * from '../src/sessions'; export * from '../src/sort'; export * from '../src/timeout'; -export * from '../src/token_bucket'; export * from '../src/transactions'; export * from '../src/utils'; export * from '../src/write_concern'; diff --git a/test/mongodb_bundled.ts b/test/mongodb_bundled.ts index 9448bf0bab5..0667751a780 100644 --- a/test/mongodb_bundled.ts +++ b/test/mongodb_bundled.ts @@ -152,7 +152,6 @@ export const { HEARTBEAT_EVENTS, HostAddress, hostMatchesWildcards, - INITIAL_TOKEN_BUCKET_SIZE, InsertOneOperation, InsertOperation, Int32, @@ -177,7 +176,6 @@ export const { ListIndexesOperation, Long, makeClientMetadata, - MAX_RETRIES, MAX_SUPPORTED_SERVER_VERSION, MAX_SUPPORTED_WIRE_VERSION, MaxKey, diff --git a/test/spec/client-backpressure/README.md b/test/spec/client-backpressure/README.md index 22efe29b207..24aea3d33ba 100644 --- a/test/spec/client-backpressure/README.md +++ b/test/spec/client-backpressure/README.md @@ -14,7 +14,8 @@ be manually implemented by each driver. #### Test 1: Operation Retry Uses Exponential Backoff -Drivers should test that retries do not occur immediately when a SystemOverloadedError is encountered. +Drivers should test that retries do not occur immediately when a SystemOverloadedError is encountered. This test MUST be +executed against a MongoDB 4.4+ server that has enabled the `configureFailPoint` command with the `errorLabels` option. 1. Let `client` be a `MongoClient` 2. Let `collection` be a collection @@ -45,26 +46,74 @@ Drivers should test that retries do not occur immediately when a SystemOverloade const end = performance.now(); ``` - 4. Configure the random number generator used for jitter to always return `1`. + 4. Configure the random number generator used for jitter to always return a number as close as possible to `1`. 5. Execute step 3 again. - 6. Compare the two time between the two runs. + 6. Compare the time between the two runs. ```python - assertTrue(with_backoff_time - no_backoff_time >= 2.1) + assertTrue(absolute_value(with_backoff_time - (no_backoff_time + 0.3 seconds)) < 0.3 seconds) ``` - The sum of 5 backoffs is 3.1 seconds. There is a 1-second window to account for potential variance between the two - runs. + The sum of 2 backoffs is 0.3 seconds. There is a 0.3-second window to account for potential variance between the + two runs. -#### Test 2: Token Bucket Capacity is Enforced +#### Test 3: Overload Errors are Retried a Maximum of MAX_RETRIES times -Drivers should test that retry token buckets are created at their maximum capacity and that that capacity is enforced. +Drivers should test that overload errors are retried a maximum of MAX_RETRIES times. This test MUST be executed against +a MongoDB 4.4+ server that has enabled the `configureFailPoint` command with the `errorLabels` option. -1. Let `client` be a `MongoClient`. -2. Assert that the client's retry token bucket is at full capacity and that the capacity is - `DEFAULT_RETRY_TOKEN_CAPACITY`. -3. Using `client`, execute a successful `ping` command. -4. Assert that the successful command did not increase the number of tokens in the bucket above - `DEFAULT_RETRY_TOKEN_CAPACITY`. +1. Let `client` be a `MongoClient` with command event monitoring enabled. + +2. Let `coll` be a collection. + +3. Configure the following failpoint: + + ```javascript + { + configureFailPoint: 'failCommand', + mode: 'alwaysOn', + data: { + failCommands: ['find'], + errorCode: 462, // IngressRequestRateLimitExceeded + errorLabels: ['SystemOverloadedError', 'RetryableError'] + } + } + ``` + +4. Perform a find operation with `coll` that fails. + +5. Assert that the raised error contains both the `RetryableError` and `SystemOverloadedError` error labels. + +6. Assert that the total number of started commands is MAX_RETRIES + 1 (3). + +#### Test 4: Overload Errors are Retried a Maximum of maxAdaptiveRetries times when configured + +Drivers should test that overload errors are retried a maximum of `maxAdaptiveRetries` times, when configured. This test +MUST be executed against a MongoDB 4.4+ server that has enabled the `configureFailPoint` command with the `errorLabels` +option. + +1. Let `client` be a `MongoClient` with `maxAdaptiveRetries=1` and command event monitoring enabled. + +2. Let `coll` be a collection. + +3. Configure the following failpoint: + + ```javascript + { + configureFailPoint: 'failCommand', + mode: 'alwaysOn', + data: { + failCommands: ['find'], + errorCode: 462, // IngressRequestRateLimitExceeded + errorLabels: ['SystemOverloadedError', 'RetryableError'] + } + } + ``` + +4. Perform a find operation with `coll` that fails. + +5. Assert that the raised error contains both the `RetryableError` and `SystemOverloadedError` error labels. + +6. Assert that the total number of started commands is `maxAdaptiveRetries` + 1 (2). diff --git a/test/spec/client-backpressure/backpressure-connection-checkin.json b/test/spec/client-backpressure/backpressure-connection-checkin.json index 340c87c0142..794951ad5ff 100644 --- a/test/spec/client-backpressure/backpressure-connection-checkin.json +++ b/test/spec/client-backpressure/backpressure-connection-checkin.json @@ -85,24 +85,6 @@ "client": "client", "eventType": "cmap", "events": [ - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, { "connectionCheckedOutEvent": {} }, diff --git a/test/spec/client-backpressure/backpressure-connection-checkin.yml b/test/spec/client-backpressure/backpressure-connection-checkin.yml index 7c4359335c3..ce8c1acb365 100644 --- a/test/spec/client-backpressure/backpressure-connection-checkin.yml +++ b/test/spec/client-backpressure/backpressure-connection-checkin.yml @@ -58,10 +58,3 @@ tests: - connectionCheckedInEvent: {} - connectionCheckedOutEvent: {} - connectionCheckedInEvent: {} - - connectionCheckedOutEvent: {} - - connectionCheckedInEvent: {} - - connectionCheckedOutEvent: {} - - connectionCheckedInEvent: {} - - connectionCheckedOutEvent: {} - - connectionCheckedInEvent: {} - diff --git a/test/spec/client-backpressure/backpressure-retry-loop.json b/test/spec/client-backpressure/backpressure-retry-loop.json index 9121b21856a..a0b4877fac6 100644 --- a/test/spec/client-backpressure/backpressure-retry-loop.json +++ b/test/spec/client-backpressure/backpressure-retry-loop.json @@ -145,7 +145,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -197,16 +197,6 @@ "commandName": "listDatabases" } }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, { "commandSucceededEvent": { "commandName": "listDatabases" @@ -283,7 +273,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -332,16 +322,6 @@ "commandName": "listDatabases" } }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, { "commandSucceededEvent": { "commandName": "listDatabases" @@ -415,7 +395,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -467,16 +447,6 @@ "commandName": "aggregate" } }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, { "commandSucceededEvent": { "commandName": "aggregate" @@ -558,7 +528,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -620,16 +590,6 @@ "commandName": "bulkWrite" } }, - { - "commandFailedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandStartedEvent": { - "commandName": "bulkWrite" - } - }, { "commandSucceededEvent": { "commandName": "bulkWrite" @@ -721,7 +681,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -780,16 +740,6 @@ "commandName": "aggregate" } }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, { "commandSucceededEvent": { "commandName": "aggregate" @@ -873,7 +823,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -925,16 +875,6 @@ "commandName": "listCollections" } }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, { "commandSucceededEvent": { "commandName": "listCollections" @@ -1011,7 +951,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -1063,16 +1003,6 @@ "commandName": "listCollections" } }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, { "commandSucceededEvent": { "commandName": "listCollections" @@ -1149,7 +1079,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -1204,16 +1134,6 @@ "commandName": "ping" } }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "ping" - } - }, { "commandSucceededEvent": { "commandName": "ping" @@ -1352,7 +1272,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -1404,16 +1324,6 @@ "commandName": "aggregate" } }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, { "commandSucceededEvent": { "commandName": "aggregate" @@ -1490,7 +1400,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -1542,16 +1452,6 @@ "commandName": "aggregate" } }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, { "commandSucceededEvent": { "commandName": "aggregate" @@ -1628,7 +1528,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -1680,16 +1580,6 @@ "commandName": "aggregate" } }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, { "commandSucceededEvent": { "commandName": "aggregate" @@ -1766,7 +1656,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -1815,16 +1705,6 @@ "commandName": "count" } }, - { - "commandFailedEvent": { - "commandName": "count" - } - }, - { - "commandStartedEvent": { - "commandName": "count" - } - }, { "commandSucceededEvent": { "commandName": "count" @@ -1898,7 +1778,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -1951,16 +1831,6 @@ "commandName": "distinct" } }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, { "commandSucceededEvent": { "commandName": "distinct" @@ -2038,7 +1908,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -2090,16 +1960,6 @@ "commandName": "find" } }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, { "commandSucceededEvent": { "commandName": "find" @@ -2176,7 +2036,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -2228,16 +2088,6 @@ "commandName": "find" } }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, { "commandSucceededEvent": { "commandName": "find" @@ -2314,7 +2164,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -2363,16 +2213,6 @@ "commandName": "listIndexes" } }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, { "commandSucceededEvent": { "commandName": "listIndexes" @@ -2446,7 +2286,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -2495,16 +2335,6 @@ "commandName": "listIndexes" } }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, { "commandSucceededEvent": { "commandName": "listIndexes" @@ -2578,7 +2408,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -2630,16 +2460,6 @@ "commandName": "aggregate" } }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, { "commandSucceededEvent": { "commandName": "aggregate" @@ -2716,7 +2536,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -2771,16 +2591,6 @@ "commandName": "insert" } }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, { "commandSucceededEvent": { "commandName": "insert" @@ -2860,7 +2670,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -2917,16 +2727,6 @@ "commandName": "insert" } }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, { "commandSucceededEvent": { "commandName": "insert" @@ -3008,7 +2808,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -3060,16 +2860,6 @@ "commandName": "delete" } }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, { "commandSucceededEvent": { "commandName": "delete" @@ -3146,7 +2936,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -3198,16 +2988,6 @@ "commandName": "delete" } }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, { "commandSucceededEvent": { "commandName": "delete" @@ -3284,7 +3064,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -3339,16 +3119,6 @@ "commandName": "update" } }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, { "commandSucceededEvent": { "commandName": "update" @@ -3428,7 +3198,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -3485,16 +3255,6 @@ "commandName": "update" } }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, { "commandSucceededEvent": { "commandName": "update" @@ -3576,7 +3336,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -3633,16 +3393,6 @@ "commandName": "update" } }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, { "commandSucceededEvent": { "commandName": "update" @@ -3724,7 +3474,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -3776,16 +3526,6 @@ "commandName": "findAndModify" } }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, { "commandSucceededEvent": { "commandName": "findAndModify" @@ -3862,7 +3602,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -3917,16 +3657,6 @@ "commandName": "findAndModify" } }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, { "commandSucceededEvent": { "commandName": "findAndModify" @@ -4006,7 +3736,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -4063,16 +3793,6 @@ "commandName": "findAndModify" } }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, { "commandSucceededEvent": { "commandName": "findAndModify" @@ -4154,7 +3874,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -4215,16 +3935,6 @@ "commandName": "insert" } }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, { "commandSucceededEvent": { "commandName": "insert" @@ -4310,7 +4020,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -4365,16 +4075,6 @@ "commandName": "createIndexes" } }, - { - "commandFailedEvent": { - "commandName": "createIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "createIndexes" - } - }, { "commandSucceededEvent": { "commandName": "createIndexes" @@ -4464,7 +4164,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -4516,16 +4216,6 @@ "commandName": "dropIndexes" } }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, { "commandSucceededEvent": { "commandName": "dropIndexes" @@ -4612,7 +4302,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -4661,16 +4351,6 @@ "commandName": "dropIndexes" } }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, { "commandSucceededEvent": { "commandName": "dropIndexes" @@ -4744,7 +4424,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -4800,16 +4480,6 @@ "commandName": "aggregate" } }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, { "commandSucceededEvent": { "commandName": "aggregate" diff --git a/test/spec/client-backpressure/backpressure-retry-loop.yml b/test/spec/client-backpressure/backpressure-retry-loop.yml index ea14aee3294..902726f6264 100644 --- a/test/spec/client-backpressure/backpressure-retry-loop.yml +++ b/test/spec/client-backpressure/backpressure-retry-loop.yml @@ -83,7 +83,7 @@ initialData: _yamlAnchors: bulWriteInsertNamespace: &client_bulk_write_ns retryable-writes-tests.coll -tests: +tests: - description: 'client.listDatabases retries using operation loop' operations: - name: failPoint @@ -92,7 +92,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [listDatabases] errorLabels: [RetryableError, SystemOverloadedError] @@ -116,10 +116,6 @@ tests: commandName: listDatabases - commandStartedEvent: commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases - - commandStartedEvent: - commandName: listDatabases - commandSucceededEvent: commandName: listDatabases - description: 'client.listDatabases (read) does not retry if retryReads=false' @@ -161,7 +157,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [listDatabases] errorLabels: [RetryableError, SystemOverloadedError] @@ -183,10 +179,6 @@ tests: commandName: listDatabases - commandStartedEvent: commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases - - commandStartedEvent: - commandName: listDatabases - commandSucceededEvent: commandName: listDatabases - description: 'client.listDatabaseNames (read) does not retry if retryReads=false' @@ -226,7 +218,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] @@ -250,10 +242,6 @@ tests: commandName: aggregate - commandStartedEvent: commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - commandSucceededEvent: commandName: aggregate - description: 'client.createChangeStream (read) does not retry if retryReads=false' @@ -297,7 +285,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [bulkWrite] errorLabels: [RetryableError, SystemOverloadedError] @@ -324,10 +312,6 @@ tests: commandName: bulkWrite - commandStartedEvent: commandName: bulkWrite - - commandFailedEvent: - commandName: bulkWrite - - commandStartedEvent: - commandName: bulkWrite - commandSucceededEvent: commandName: bulkWrite - description: 'client.clientBulkWrite (write) does not retry if retryWrites=false' @@ -374,7 +358,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] @@ -398,10 +382,6 @@ tests: commandName: aggregate - commandStartedEvent: commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - commandSucceededEvent: commandName: aggregate - description: 'database.aggregate (read) does not retry if retryReads=false' @@ -443,7 +423,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [listCollections] errorLabels: [RetryableError, SystemOverloadedError] @@ -467,10 +447,6 @@ tests: commandName: listCollections - commandStartedEvent: commandName: listCollections - - commandFailedEvent: - commandName: listCollections - - commandStartedEvent: - commandName: listCollections - commandSucceededEvent: commandName: listCollections - description: 'database.listCollections (read) does not retry if retryReads=false' @@ -512,7 +488,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [listCollections] errorLabels: [RetryableError, SystemOverloadedError] @@ -536,10 +512,6 @@ tests: commandName: listCollections - commandStartedEvent: commandName: listCollections - - commandFailedEvent: - commandName: listCollections - - commandStartedEvent: - commandName: listCollections - commandSucceededEvent: commandName: listCollections - description: 'database.listCollectionNames (read) does not retry if retryReads=false' @@ -581,7 +553,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [ping] errorLabels: [RetryableError, SystemOverloadedError] @@ -606,10 +578,6 @@ tests: commandName: ping - commandStartedEvent: commandName: ping - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: ping - commandSucceededEvent: commandName: ping - description: 'database.runCommand (read) does not retry if retryReads=false' @@ -682,7 +650,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] @@ -706,10 +674,6 @@ tests: commandName: aggregate - commandStartedEvent: commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - commandSucceededEvent: commandName: aggregate - description: 'database.createChangeStream (read) does not retry if retryReads=false' @@ -751,7 +715,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] @@ -775,10 +739,6 @@ tests: commandName: aggregate - commandStartedEvent: commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - commandSucceededEvent: commandName: aggregate - description: 'collection.aggregate (read) does not retry if retryReads=false' @@ -820,7 +780,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] @@ -844,10 +804,6 @@ tests: commandName: aggregate - commandStartedEvent: commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - commandSucceededEvent: commandName: aggregate - description: 'collection.countDocuments (read) does not retry if retryReads=false' @@ -889,7 +845,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [count] errorLabels: [RetryableError, SystemOverloadedError] @@ -911,10 +867,6 @@ tests: commandName: count - commandStartedEvent: commandName: count - - commandFailedEvent: - commandName: count - - commandStartedEvent: - commandName: count - commandSucceededEvent: commandName: count - description: 'collection.estimatedDocumentCount (read) does not retry if retryReads=false' @@ -954,7 +906,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [distinct] errorLabels: [RetryableError, SystemOverloadedError] @@ -979,10 +931,6 @@ tests: commandName: distinct - commandStartedEvent: commandName: distinct - - commandFailedEvent: - commandName: distinct - - commandStartedEvent: - commandName: distinct - commandSucceededEvent: commandName: distinct - description: 'collection.distinct (read) does not retry if retryReads=false' @@ -1025,7 +973,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [find] errorLabels: [RetryableError, SystemOverloadedError] @@ -1049,10 +997,6 @@ tests: commandName: find - commandStartedEvent: commandName: find - - commandFailedEvent: - commandName: find - - commandStartedEvent: - commandName: find - commandSucceededEvent: commandName: find - description: 'collection.find (read) does not retry if retryReads=false' @@ -1094,7 +1038,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [find] errorLabels: [RetryableError, SystemOverloadedError] @@ -1118,10 +1062,6 @@ tests: commandName: find - commandStartedEvent: commandName: find - - commandFailedEvent: - commandName: find - - commandStartedEvent: - commandName: find - commandSucceededEvent: commandName: find - description: 'collection.findOne (read) does not retry if retryReads=false' @@ -1163,7 +1103,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [listIndexes] errorLabels: [RetryableError, SystemOverloadedError] @@ -1185,10 +1125,6 @@ tests: commandName: listIndexes - commandStartedEvent: commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes - - commandStartedEvent: - commandName: listIndexes - commandSucceededEvent: commandName: listIndexes - description: 'collection.listIndexes (read) does not retry if retryReads=false' @@ -1228,7 +1164,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [listIndexes] errorLabels: [RetryableError, SystemOverloadedError] @@ -1250,10 +1186,6 @@ tests: commandName: listIndexes - commandStartedEvent: commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes - - commandStartedEvent: - commandName: listIndexes - commandSucceededEvent: commandName: listIndexes - description: 'collection.listIndexNames (read) does not retry if retryReads=false' @@ -1293,7 +1225,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] @@ -1317,10 +1249,6 @@ tests: commandName: aggregate - commandStartedEvent: commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - commandSucceededEvent: commandName: aggregate - description: 'collection.createChangeStream (read) does not retry if retryReads=false' @@ -1362,7 +1290,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] @@ -1386,10 +1314,6 @@ tests: commandName: insert - commandStartedEvent: commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - commandSucceededEvent: commandName: insert - description: 'collection.insertOne (write) does not retry if retryWrites=false' @@ -1431,7 +1355,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] @@ -1456,10 +1380,6 @@ tests: commandName: insert - commandStartedEvent: commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - commandSucceededEvent: commandName: insert - description: 'collection.insertMany (write) does not retry if retryWrites=false' @@ -1502,7 +1422,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [delete] errorLabels: [RetryableError, SystemOverloadedError] @@ -1526,10 +1446,6 @@ tests: commandName: delete - commandStartedEvent: commandName: delete - - commandFailedEvent: - commandName: delete - - commandStartedEvent: - commandName: delete - commandSucceededEvent: commandName: delete - description: 'collection.deleteOne (write) does not retry if retryWrites=false' @@ -1571,7 +1487,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [delete] errorLabels: [RetryableError, SystemOverloadedError] @@ -1595,10 +1511,6 @@ tests: commandName: delete - commandStartedEvent: commandName: delete - - commandFailedEvent: - commandName: delete - - commandStartedEvent: - commandName: delete - commandSucceededEvent: commandName: delete - description: 'collection.deleteMany (write) does not retry if retryWrites=false' @@ -1640,7 +1552,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] @@ -1665,10 +1577,6 @@ tests: commandName: update - commandStartedEvent: commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - commandSucceededEvent: commandName: update - description: 'collection.replaceOne (write) does not retry if retryWrites=false' @@ -1711,7 +1619,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] @@ -1736,10 +1644,6 @@ tests: commandName: update - commandStartedEvent: commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - commandSucceededEvent: commandName: update - description: 'collection.updateOne (write) does not retry if retryWrites=false' @@ -1782,7 +1686,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [update] errorLabels: [RetryableError, SystemOverloadedError] @@ -1807,10 +1711,6 @@ tests: commandName: update - commandStartedEvent: commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - commandSucceededEvent: commandName: update - description: 'collection.updateMany (write) does not retry if retryWrites=false' @@ -1853,7 +1753,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] @@ -1877,10 +1777,6 @@ tests: commandName: findAndModify - commandStartedEvent: commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - commandSucceededEvent: commandName: findAndModify - description: 'collection.findOneAndDelete (write) does not retry if retryWrites=false' @@ -1922,7 +1818,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] @@ -1947,10 +1843,6 @@ tests: commandName: findAndModify - commandStartedEvent: commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - commandSucceededEvent: commandName: findAndModify - description: 'collection.findOneAndReplace (write) does not retry if retryWrites=false' @@ -1993,7 +1885,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [findAndModify] errorLabels: [RetryableError, SystemOverloadedError] @@ -2018,10 +1910,6 @@ tests: commandName: findAndModify - commandStartedEvent: commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - commandSucceededEvent: commandName: findAndModify - description: 'collection.findOneAndUpdate (write) does not retry if retryWrites=false' @@ -2064,7 +1952,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [insert] errorLabels: [RetryableError, SystemOverloadedError] @@ -2090,10 +1978,6 @@ tests: commandName: insert - commandStartedEvent: commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - commandSucceededEvent: commandName: insert - description: 'collection.bulkWrite (write) does not retry if retryWrites=false' @@ -2137,7 +2021,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [createIndexes] errorLabels: [RetryableError, SystemOverloadedError] @@ -2162,10 +2046,6 @@ tests: commandName: createIndexes - commandStartedEvent: commandName: createIndexes - - commandFailedEvent: - commandName: createIndexes - - commandStartedEvent: - commandName: createIndexes - commandSucceededEvent: commandName: createIndexes - description: 'collection.createIndex (write) does not retry if retryWrites=false' @@ -2213,7 +2093,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [dropIndexes] errorLabels: [RetryableError, SystemOverloadedError] @@ -2237,10 +2117,6 @@ tests: commandName: dropIndexes - commandStartedEvent: commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes - - commandStartedEvent: - commandName: dropIndexes - commandSucceededEvent: commandName: dropIndexes - description: 'collection.dropIndex (write) does not retry if retryWrites=false' @@ -2287,7 +2163,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [dropIndexes] errorLabels: [RetryableError, SystemOverloadedError] @@ -2309,10 +2185,6 @@ tests: commandName: dropIndexes - commandStartedEvent: commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes - - commandStartedEvent: - commandName: dropIndexes - commandSucceededEvent: commandName: dropIndexes - description: 'collection.dropIndexes (write) does not retry if retryWrites=false' @@ -2352,7 +2224,7 @@ tests: client: *internal_client failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [aggregate] errorLabels: [RetryableError, SystemOverloadedError] @@ -2376,10 +2248,6 @@ tests: commandName: aggregate - commandStartedEvent: commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - commandSucceededEvent: commandName: aggregate - description: 'collection.aggregate (write) does not retry if retryWrites=false' @@ -2411,3 +2279,4 @@ tests: commandName: aggregate - commandFailedEvent: commandName: aggregate + diff --git a/test/spec/client-backpressure/backpressure-retry-max-attempts.json b/test/spec/client-backpressure/backpressure-retry-max-attempts.json index ed2352ca83a..de525727655 100644 --- a/test/spec/client-backpressure/backpressure-retry-max-attempts.json +++ b/test/spec/client-backpressure/backpressure-retry-max-attempts.json @@ -1,5 +1,5 @@ { - "description": "tests that operations retry at most maxAttempts=5 times", + "description": "tests that operations retry at most maxAttempts=2 times", "schemaVersion": "1.3", "runOnRequirements": [ { @@ -68,7 +68,7 @@ ], "tests": [ { - "description": "client.listDatabases retries at most maxAttempts=5 times", + "description": "client.listDatabases retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -107,36 +107,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, { "commandStartedEvent": { "commandName": "listDatabases" @@ -172,7 +142,7 @@ ] }, { - "description": "client.listDatabaseNames retries at most maxAttempts=5 times", + "description": "client.listDatabaseNames retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -208,36 +178,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - }, { "commandStartedEvent": { "commandName": "listDatabases" @@ -273,7 +213,7 @@ ] }, { - "description": "client.createChangeStream retries at most maxAttempts=5 times", + "description": "client.createChangeStream retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -312,36 +252,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, { "commandStartedEvent": { "commandName": "aggregate" @@ -377,7 +287,7 @@ ] }, { - "description": "client.clientBulkWrite retries at most maxAttempts=5 times", + "description": "client.clientBulkWrite retries at most maxAttempts=2 times", "runOnRequirements": [ { "minServerVersion": "8.0" @@ -431,36 +341,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandFailedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandStartedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandFailedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandStartedEvent": { - "commandName": "bulkWrite" - } - }, - { - "commandFailedEvent": { - "commandName": "bulkWrite" - } - }, { "commandStartedEvent": { "commandName": "bulkWrite" @@ -496,7 +376,7 @@ ] }, { - "description": "database.aggregate read retries at most maxAttempts=5 times", + "description": "database.aggregate read retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -542,36 +422,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, { "commandStartedEvent": { "commandName": "aggregate" @@ -607,7 +457,7 @@ ] }, { - "description": "database.listCollections retries at most maxAttempts=5 times", + "description": "database.listCollections retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -646,36 +496,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, { "commandStartedEvent": { "commandName": "listCollections" @@ -711,7 +531,7 @@ ] }, { - "description": "database.listCollectionNames retries at most maxAttempts=5 times", + "description": "database.listCollectionNames retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -750,36 +570,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - }, { "commandStartedEvent": { "commandName": "listCollections" @@ -815,7 +605,7 @@ ] }, { - "description": "database.runCommand retries at most maxAttempts=5 times", + "description": "database.runCommand retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -857,36 +647,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "ping" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "ping" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "ping" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, { "commandStartedEvent": { "commandName": "ping" @@ -922,7 +682,7 @@ ] }, { - "description": "database.createChangeStream retries at most maxAttempts=5 times", + "description": "database.createChangeStream retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -961,36 +721,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, { "commandStartedEvent": { "commandName": "aggregate" @@ -1026,7 +756,7 @@ ] }, { - "description": "collection.aggregate read retries at most maxAttempts=5 times", + "description": "collection.aggregate read retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1065,36 +795,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, { "commandStartedEvent": { "commandName": "aggregate" @@ -1130,7 +830,7 @@ ] }, { - "description": "collection.countDocuments retries at most maxAttempts=5 times", + "description": "collection.countDocuments retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1169,36 +869,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, { "commandStartedEvent": { "commandName": "aggregate" @@ -1234,7 +904,7 @@ ] }, { - "description": "collection.estimatedDocumentCount retries at most maxAttempts=5 times", + "description": "collection.estimatedDocumentCount retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1270,36 +940,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandFailedEvent": { - "commandName": "count" - } - }, - { - "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandFailedEvent": { - "commandName": "count" - } - }, - { - "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandFailedEvent": { - "commandName": "count" - } - }, { "commandStartedEvent": { "commandName": "count" @@ -1335,7 +975,7 @@ ] }, { - "description": "collection.distinct retries at most maxAttempts=5 times", + "description": "collection.distinct retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1375,36 +1015,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - }, { "commandStartedEvent": { "commandName": "distinct" @@ -1440,7 +1050,7 @@ ] }, { - "description": "collection.find retries at most maxAttempts=5 times", + "description": "collection.find retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1479,36 +1089,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, { "commandStartedEvent": { "commandName": "find" @@ -1544,7 +1124,7 @@ ] }, { - "description": "collection.findOne retries at most maxAttempts=5 times", + "description": "collection.findOne retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1583,36 +1163,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - }, { "commandStartedEvent": { "commandName": "find" @@ -1648,7 +1198,7 @@ ] }, { - "description": "collection.listIndexes retries at most maxAttempts=5 times", + "description": "collection.listIndexes retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1684,36 +1234,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, { "commandStartedEvent": { "commandName": "listIndexes" @@ -1749,7 +1269,7 @@ ] }, { - "description": "collection.listIndexNames retries at most maxAttempts=5 times", + "description": "collection.listIndexNames retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1785,36 +1305,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - }, { "commandStartedEvent": { "commandName": "listIndexes" @@ -1850,7 +1340,7 @@ ] }, { - "description": "collection.createChangeStream retries at most maxAttempts=5 times", + "description": "collection.createChangeStream retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1889,36 +1379,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, { "commandStartedEvent": { "commandName": "aggregate" @@ -1954,7 +1414,7 @@ ] }, { - "description": "collection.insertOne retries at most maxAttempts=5 times", + "description": "collection.insertOne retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -1996,36 +1456,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, { "commandStartedEvent": { "commandName": "insert" @@ -2061,7 +1491,7 @@ ] }, { - "description": "collection.insertMany retries at most maxAttempts=5 times", + "description": "collection.insertMany retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2105,36 +1535,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, { "commandStartedEvent": { "commandName": "insert" @@ -2170,7 +1570,7 @@ ] }, { - "description": "collection.deleteOne retries at most maxAttempts=5 times", + "description": "collection.deleteOne retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2209,36 +1609,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, { "commandStartedEvent": { "commandName": "delete" @@ -2274,7 +1644,7 @@ ] }, { - "description": "collection.deleteMany retries at most maxAttempts=5 times", + "description": "collection.deleteMany retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2313,36 +1683,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - }, { "commandStartedEvent": { "commandName": "delete" @@ -2378,7 +1718,7 @@ ] }, { - "description": "collection.replaceOne retries at most maxAttempts=5 times", + "description": "collection.replaceOne retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2420,36 +1760,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, { "commandStartedEvent": { "commandName": "update" @@ -2485,7 +1795,7 @@ ] }, { - "description": "collection.updateOne retries at most maxAttempts=5 times", + "description": "collection.updateOne retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2529,36 +1839,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, { "commandStartedEvent": { "commandName": "update" @@ -2594,7 +1874,7 @@ ] }, { - "description": "collection.updateMany retries at most maxAttempts=5 times", + "description": "collection.updateMany retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2622,52 +1902,22 @@ "object": "collection", "arguments": { "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandFailedEvent": { - "commandName": "update" + "update": { + "$set": { + "x": 22 } - }, + } + }, + "expectError": { + "isError": true, + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client", + "events": [ { "commandStartedEvent": { "commandName": "update" @@ -2703,7 +1953,7 @@ ] }, { - "description": "collection.findOneAndDelete retries at most maxAttempts=5 times", + "description": "collection.findOneAndDelete retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2742,36 +1992,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, { "commandStartedEvent": { "commandName": "findAndModify" @@ -2807,7 +2027,7 @@ ] }, { - "description": "collection.findOneAndReplace retries at most maxAttempts=5 times", + "description": "collection.findOneAndReplace retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2849,36 +2069,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, { "commandStartedEvent": { "commandName": "findAndModify" @@ -2914,7 +2104,7 @@ ] }, { - "description": "collection.findOneAndUpdate retries at most maxAttempts=5 times", + "description": "collection.findOneAndUpdate retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -2958,36 +2148,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - }, { "commandStartedEvent": { "commandName": "findAndModify" @@ -3023,7 +2183,7 @@ ] }, { - "description": "collection.bulkWrite retries at most maxAttempts=5 times", + "description": "collection.bulkWrite retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -3071,36 +2231,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - }, { "commandStartedEvent": { "commandName": "insert" @@ -3136,7 +2266,7 @@ ] }, { - "description": "collection.createIndex retries at most maxAttempts=5 times", + "description": "collection.createIndex retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -3178,36 +2308,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "createIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "createIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "createIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "createIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "createIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "createIndexes" - } - }, { "commandStartedEvent": { "commandName": "createIndexes" @@ -3243,7 +2343,7 @@ ] }, { - "description": "collection.dropIndex retries at most maxAttempts=5 times", + "description": "collection.dropIndex retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -3282,36 +2382,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, { "commandStartedEvent": { "commandName": "dropIndexes" @@ -3347,7 +2417,7 @@ ] }, { - "description": "collection.dropIndexes retries at most maxAttempts=5 times", + "description": "collection.dropIndexes retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -3383,36 +2453,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandStartedEvent": { - "commandName": "dropIndexes" - } - }, - { - "commandFailedEvent": { - "commandName": "dropIndexes" - } - }, { "commandStartedEvent": { "commandName": "dropIndexes" @@ -3448,7 +2488,7 @@ ] }, { - "description": "collection.aggregate write retries at most maxAttempts=5 times", + "description": "collection.aggregate write retries at most maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -3491,36 +2531,6 @@ { "client": "client", "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - }, { "commandStartedEvent": { "commandName": "aggregate" diff --git a/test/spec/client-backpressure/backpressure-retry-max-attempts.yml b/test/spec/client-backpressure/backpressure-retry-max-attempts.yml index ec7b5e49dc1..eec89671fa4 100644 --- a/test/spec/client-backpressure/backpressure-retry-max-attempts.yml +++ b/test/spec/client-backpressure/backpressure-retry-max-attempts.yml @@ -1,6 +1,6 @@ # Tests in this file are generated from backpressure-retry-max-attempts.yml.template. -description: tests that operations retry at most maxAttempts=5 times +description: tests that operations retry at most maxAttempts=2 times schemaVersion: '1.3' @@ -40,8 +40,8 @@ initialData: - { _id: 1, x: 11 } - { _id: 2, x: 22 } -tests: - - description: 'client.listDatabases retries at most maxAttempts=5 times' +tests: + - description: 'client.listDatabases retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -66,20 +66,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases - - commandStartedEvent: - commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases - - commandStartedEvent: - commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: listDatabases - commandFailedEvent: @@ -93,7 +81,7 @@ tests: - commandFailedEvent: commandName: listDatabases - - description: 'client.listDatabaseNames retries at most maxAttempts=5 times' + - description: 'client.listDatabaseNames retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -116,20 +104,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases - - commandStartedEvent: - commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases - - commandStartedEvent: - commandName: listDatabases - - commandFailedEvent: - commandName: listDatabases + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: listDatabases - commandFailedEvent: @@ -143,7 +119,7 @@ tests: - commandFailedEvent: commandName: listDatabases - - description: 'client.createChangeStream retries at most maxAttempts=5 times' + - description: 'client.createChangeStream retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -168,20 +144,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: aggregate - commandFailedEvent: @@ -195,7 +159,7 @@ tests: - commandFailedEvent: commandName: aggregate - - description: 'client.clientBulkWrite retries at most maxAttempts=5 times' + - description: 'client.clientBulkWrite retries at most maxAttempts=2 times' runOnRequirements: - minServerVersion: '8.0' # client bulk write added to server in 8.0 operations: @@ -225,20 +189,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: bulkWrite - - commandFailedEvent: - commandName: bulkWrite - - commandStartedEvent: - commandName: bulkWrite - - commandFailedEvent: - commandName: bulkWrite - - commandStartedEvent: - commandName: bulkWrite - - commandFailedEvent: - commandName: bulkWrite + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: bulkWrite - commandFailedEvent: @@ -252,7 +204,7 @@ tests: - commandFailedEvent: commandName: bulkWrite - - description: 'database.aggregate read retries at most maxAttempts=5 times' + - description: 'database.aggregate read retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -277,20 +229,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: aggregate - commandFailedEvent: @@ -304,7 +244,7 @@ tests: - commandFailedEvent: commandName: aggregate - - description: 'database.listCollections retries at most maxAttempts=5 times' + - description: 'database.listCollections retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -329,20 +269,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: listCollections - - commandFailedEvent: - commandName: listCollections - - commandStartedEvent: - commandName: listCollections - - commandFailedEvent: - commandName: listCollections - - commandStartedEvent: - commandName: listCollections - - commandFailedEvent: - commandName: listCollections + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: listCollections - commandFailedEvent: @@ -356,7 +284,7 @@ tests: - commandFailedEvent: commandName: listCollections - - description: 'database.listCollectionNames retries at most maxAttempts=5 times' + - description: 'database.listCollectionNames retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -381,20 +309,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: listCollections - - commandFailedEvent: - commandName: listCollections - - commandStartedEvent: - commandName: listCollections - - commandFailedEvent: - commandName: listCollections - - commandStartedEvent: - commandName: listCollections - - commandFailedEvent: - commandName: listCollections + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: listCollections - commandFailedEvent: @@ -408,7 +324,7 @@ tests: - commandFailedEvent: commandName: listCollections - - description: 'database.runCommand retries at most maxAttempts=5 times' + - description: 'database.runCommand retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -434,20 +350,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: ping - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: ping - - commandFailedEvent: - commandName: ping - - commandStartedEvent: - commandName: ping - - commandFailedEvent: - commandName: ping + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: ping - commandFailedEvent: @@ -461,7 +365,7 @@ tests: - commandFailedEvent: commandName: ping - - description: 'database.createChangeStream retries at most maxAttempts=5 times' + - description: 'database.createChangeStream retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -486,20 +390,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: aggregate - commandFailedEvent: @@ -513,7 +405,7 @@ tests: - commandFailedEvent: commandName: aggregate - - description: 'collection.aggregate read retries at most maxAttempts=5 times' + - description: 'collection.aggregate read retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -538,20 +430,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: aggregate - commandFailedEvent: @@ -565,7 +445,7 @@ tests: - commandFailedEvent: commandName: aggregate - - description: 'collection.countDocuments retries at most maxAttempts=5 times' + - description: 'collection.countDocuments retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -590,20 +470,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: aggregate - commandFailedEvent: @@ -617,7 +485,7 @@ tests: - commandFailedEvent: commandName: aggregate - - description: 'collection.estimatedDocumentCount retries at most maxAttempts=5 times' + - description: 'collection.estimatedDocumentCount retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -640,20 +508,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: count - - commandFailedEvent: - commandName: count - - commandStartedEvent: - commandName: count - - commandFailedEvent: - commandName: count - - commandStartedEvent: - commandName: count - - commandFailedEvent: - commandName: count + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: count - commandFailedEvent: @@ -667,7 +523,7 @@ tests: - commandFailedEvent: commandName: count - - description: 'collection.distinct retries at most maxAttempts=5 times' + - description: 'collection.distinct retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -693,20 +549,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: distinct - - commandFailedEvent: - commandName: distinct - - commandStartedEvent: - commandName: distinct - - commandFailedEvent: - commandName: distinct - - commandStartedEvent: - commandName: distinct - - commandFailedEvent: - commandName: distinct + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: distinct - commandFailedEvent: @@ -720,7 +564,7 @@ tests: - commandFailedEvent: commandName: distinct - - description: 'collection.find retries at most maxAttempts=5 times' + - description: 'collection.find retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -745,20 +589,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: find - - commandFailedEvent: - commandName: find - - commandStartedEvent: - commandName: find - - commandFailedEvent: - commandName: find - - commandStartedEvent: - commandName: find - - commandFailedEvent: - commandName: find + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: find - commandFailedEvent: @@ -772,7 +604,7 @@ tests: - commandFailedEvent: commandName: find - - description: 'collection.findOne retries at most maxAttempts=5 times' + - description: 'collection.findOne retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -797,20 +629,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: find - - commandFailedEvent: - commandName: find - - commandStartedEvent: - commandName: find - - commandFailedEvent: - commandName: find - - commandStartedEvent: - commandName: find - - commandFailedEvent: - commandName: find + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: find - commandFailedEvent: @@ -824,7 +644,7 @@ tests: - commandFailedEvent: commandName: find - - description: 'collection.listIndexes retries at most maxAttempts=5 times' + - description: 'collection.listIndexes retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -847,20 +667,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes - - commandStartedEvent: - commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes - - commandStartedEvent: - commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: listIndexes - commandFailedEvent: @@ -874,7 +682,7 @@ tests: - commandFailedEvent: commandName: listIndexes - - description: 'collection.listIndexNames retries at most maxAttempts=5 times' + - description: 'collection.listIndexNames retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -897,20 +705,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes - - commandStartedEvent: - commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes - - commandStartedEvent: - commandName: listIndexes - - commandFailedEvent: - commandName: listIndexes + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: listIndexes - commandFailedEvent: @@ -924,7 +720,7 @@ tests: - commandFailedEvent: commandName: listIndexes - - description: 'collection.createChangeStream retries at most maxAttempts=5 times' + - description: 'collection.createChangeStream retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -949,20 +745,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: aggregate - commandFailedEvent: @@ -976,7 +760,7 @@ tests: - commandFailedEvent: commandName: aggregate - - description: 'collection.insertOne retries at most maxAttempts=5 times' + - description: 'collection.insertOne retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1001,20 +785,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: insert - commandFailedEvent: @@ -1028,7 +800,7 @@ tests: - commandFailedEvent: commandName: insert - - description: 'collection.insertMany retries at most maxAttempts=5 times' + - description: 'collection.insertMany retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1054,20 +826,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: insert - commandFailedEvent: @@ -1081,7 +841,7 @@ tests: - commandFailedEvent: commandName: insert - - description: 'collection.deleteOne retries at most maxAttempts=5 times' + - description: 'collection.deleteOne retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1106,20 +866,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: delete - - commandFailedEvent: - commandName: delete - - commandStartedEvent: - commandName: delete - - commandFailedEvent: - commandName: delete - - commandStartedEvent: - commandName: delete - - commandFailedEvent: - commandName: delete + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: delete - commandFailedEvent: @@ -1133,7 +881,7 @@ tests: - commandFailedEvent: commandName: delete - - description: 'collection.deleteMany retries at most maxAttempts=5 times' + - description: 'collection.deleteMany retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1158,20 +906,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: delete - - commandFailedEvent: - commandName: delete - - commandStartedEvent: - commandName: delete - - commandFailedEvent: - commandName: delete - - commandStartedEvent: - commandName: delete - - commandFailedEvent: - commandName: delete + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: delete - commandFailedEvent: @@ -1185,7 +921,7 @@ tests: - commandFailedEvent: commandName: delete - - description: 'collection.replaceOne retries at most maxAttempts=5 times' + - description: 'collection.replaceOne retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1211,20 +947,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: update - commandFailedEvent: @@ -1238,7 +962,7 @@ tests: - commandFailedEvent: commandName: update - - description: 'collection.updateOne retries at most maxAttempts=5 times' + - description: 'collection.updateOne retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1264,20 +988,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: update - commandFailedEvent: @@ -1291,7 +1003,7 @@ tests: - commandFailedEvent: commandName: update - - description: 'collection.updateMany retries at most maxAttempts=5 times' + - description: 'collection.updateMany retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1317,20 +1029,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update - - commandStartedEvent: - commandName: update - - commandFailedEvent: - commandName: update + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: update - commandFailedEvent: @@ -1344,7 +1044,7 @@ tests: - commandFailedEvent: commandName: update - - description: 'collection.findOneAndDelete retries at most maxAttempts=5 times' + - description: 'collection.findOneAndDelete retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1369,20 +1069,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: findAndModify - commandFailedEvent: @@ -1396,7 +1084,7 @@ tests: - commandFailedEvent: commandName: findAndModify - - description: 'collection.findOneAndReplace retries at most maxAttempts=5 times' + - description: 'collection.findOneAndReplace retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1422,20 +1110,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: findAndModify - commandFailedEvent: @@ -1449,7 +1125,7 @@ tests: - commandFailedEvent: commandName: findAndModify - - description: 'collection.findOneAndUpdate retries at most maxAttempts=5 times' + - description: 'collection.findOneAndUpdate retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1475,20 +1151,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify - - commandStartedEvent: - commandName: findAndModify - - commandFailedEvent: - commandName: findAndModify + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: findAndModify - commandFailedEvent: @@ -1502,7 +1166,7 @@ tests: - commandFailedEvent: commandName: findAndModify - - description: 'collection.bulkWrite retries at most maxAttempts=5 times' + - description: 'collection.bulkWrite retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1529,20 +1193,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - - commandFailedEvent: - commandName: insert + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: insert - commandFailedEvent: @@ -1556,7 +1208,7 @@ tests: - commandFailedEvent: commandName: insert - - description: 'collection.createIndex retries at most maxAttempts=5 times' + - description: 'collection.createIndex retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1582,20 +1234,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: createIndexes - - commandFailedEvent: - commandName: createIndexes - - commandStartedEvent: - commandName: createIndexes - - commandFailedEvent: - commandName: createIndexes - - commandStartedEvent: - commandName: createIndexes - - commandFailedEvent: - commandName: createIndexes + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: createIndexes - commandFailedEvent: @@ -1609,7 +1249,7 @@ tests: - commandFailedEvent: commandName: createIndexes - - description: 'collection.dropIndex retries at most maxAttempts=5 times' + - description: 'collection.dropIndex retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1634,20 +1274,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes - - commandStartedEvent: - commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes - - commandStartedEvent: - commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: dropIndexes - commandFailedEvent: @@ -1661,7 +1289,7 @@ tests: - commandFailedEvent: commandName: dropIndexes - - description: 'collection.dropIndexes retries at most maxAttempts=5 times' + - description: 'collection.dropIndexes retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1684,20 +1312,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes - - commandStartedEvent: - commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes - - commandStartedEvent: - commandName: dropIndexes - - commandFailedEvent: - commandName: dropIndexes + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: dropIndexes - commandFailedEvent: @@ -1711,7 +1327,7 @@ tests: - commandFailedEvent: commandName: dropIndexes - - description: 'collection.aggregate write retries at most maxAttempts=5 times' + - description: 'collection.aggregate write retries at most maxAttempts=2 times' operations: - name: failPoint object: testRunner @@ -1736,20 +1352,8 @@ tests: expectEvents: - client: *client events: - # we expect 6 pairs of command started and succeeded events: - # 1 initial attempt and 5 retries. - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate - - commandStartedEvent: - commandName: aggregate - - commandFailedEvent: - commandName: aggregate + # we expect 3 pairs of command started and succeeded events: + # 1 initial attempt and 2 retries. - commandStartedEvent: commandName: aggregate - commandFailedEvent: diff --git a/test/spec/client-backpressure/getMore-retried.json b/test/spec/client-backpressure/getMore-retried.json index 5fd76be6796..d7607d694b7 100644 --- a/test/spec/client-backpressure/getMore-retried.json +++ b/test/spec/client-backpressure/getMore-retried.json @@ -68,7 +68,7 @@ "failPoint": { "configureFailPoint": "failCommand", "mode": { - "times": 3 + "times": 2 }, "data": { "failCommands": [ @@ -145,16 +145,6 @@ "commandName": "getMore" } }, - { - "commandFailedEvent": { - "commandName": "getMore" - } - }, - { - "commandStartedEvent": { - "commandName": "getMore" - } - }, { "commandSucceededEvent": { "commandName": "getMore" @@ -165,7 +155,7 @@ ] }, { - "description": "getMores are retried maxAttempts=5 times", + "description": "getMores are retried maxAttempts=2 times", "operations": [ { "name": "failPoint", @@ -245,36 +235,6 @@ "commandName": "getMore" } }, - { - "commandStartedEvent": { - "commandName": "getMore" - } - }, - { - "commandFailedEvent": { - "commandName": "getMore" - } - }, - { - "commandStartedEvent": { - "commandName": "getMore" - } - }, - { - "commandFailedEvent": { - "commandName": "getMore" - } - }, - { - "commandStartedEvent": { - "commandName": "getMore" - } - }, - { - "commandFailedEvent": { - "commandName": "getMore" - } - }, { "commandStartedEvent": { "commandName": "killCursors" diff --git a/test/spec/client-backpressure/getMore-retried.yml b/test/spec/client-backpressure/getMore-retried.yml index d7111f6e50f..cd8198383ab 100644 --- a/test/spec/client-backpressure/getMore-retried.yml +++ b/test/spec/client-backpressure/getMore-retried.yml @@ -38,7 +38,7 @@ tests: client: *failPointClient failPoint: configureFailPoint: failCommand - mode: { times: 3 } + mode: { times: 2 } data: failCommands: [getMore] errorLabels: [RetryableError, SystemOverloadedError] @@ -70,11 +70,6 @@ tests: - commandFailedEvent: commandName: getMore # second attempt - - commandStartedEvent: - commandName: getMore - - commandFailedEvent: - commandName: getMore - # third attempt - commandStartedEvent: commandName: getMore - commandFailedEvent: @@ -85,7 +80,7 @@ tests: - commandSucceededEvent: commandName: getMore - - description: "getMores are retried maxAttempts=5 times" + - description: "getMores are retried maxAttempts=2 times" operations: - name: failPoint object: testRunner @@ -126,21 +121,6 @@ tests: - commandFailedEvent: commandName: getMore # third attempt - - commandStartedEvent: - commandName: getMore - - commandFailedEvent: - commandName: getMore - # fourth attempt - - commandStartedEvent: - commandName: getMore - - commandFailedEvent: - commandName: getMore - # fifth attempt - - commandStartedEvent: - commandName: getMore - - commandFailedEvent: - commandName: getMore - # final attempt - commandStartedEvent: commandName: getMore - commandFailedEvent: diff --git a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-error-fail.json b/test/spec/server-discovery-and-monitoring/unified/backpressure-network-error-fail.json deleted file mode 100644 index f41b76459cb..00000000000 --- a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-error-fail.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "description": "backpressure-network-error-fail", - "schemaVersion": "1.17", - "runOnRequirements": [ - { - "minServerVersion": "4.4", - "serverless": "forbid", - "topologies": [ - "single", - "replicaset", - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "setupClient", - "useMultipleMongoses": false - } - } - ], - "initialData": [ - { - "collectionName": "backpressure-network-error-fail", - "databaseName": "sdam-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "apply backpressure on network connection errors during connection establishment", - "operations": [ - { - "name": "createEntities", - "object": "testRunner", - "arguments": { - "entities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "serverHeartbeatSucceededEvent", - "poolClearedEvent" - ], - "uriOptions": { - "retryWrites": false, - "heartbeatFrequencyMS": 1000000, - "serverMonitoringMode": "poll", - "appname": "backpressureNetworkErrorFailTest" - } - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "sdam-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "backpressure-network-error-fail" - } - } - ] - } - }, - { - "name": "waitForEvent", - "object": "testRunner", - "arguments": { - "client": "client", - "event": { - "serverHeartbeatSucceededEvent": {} - }, - "count": 1 - } - }, - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "setupClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": "alwaysOn", - "data": { - "failCommands": [ - "isMaster", - "hello" - ], - "appName": "backpressureNetworkErrorFailTest", - "closeConnection": true - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "SystemOverloadedError", - "RetryableError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [] - } - ] - } - ] -} diff --git a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-error-fail.yml b/test/spec/server-discovery-and-monitoring/unified/backpressure-network-error-fail.yml deleted file mode 100644 index 54e30302115..00000000000 --- a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-error-fail.yml +++ /dev/null @@ -1,80 +0,0 @@ -description: backpressure-network-error-fail -schemaVersion: "1.17" -runOnRequirements: - - minServerVersion: "4.4" - serverless: forbid - topologies: - - single - - replicaset - - sharded -createEntities: - - client: - id: setupClient - useMultipleMongoses: false -initialData: - - collectionName: backpressure-network-error-fail - databaseName: sdam-tests - documents: - - _id: 1 - - _id: 2 -tests: - - description: apply backpressure on network connection errors during connection establishment - operations: - - name: createEntities - object: testRunner - arguments: - entities: - - client: - id: client - useMultipleMongoses: false - observeEvents: - - serverHeartbeatSucceededEvent - - poolClearedEvent - uriOptions: - retryWrites: false - heartbeatFrequencyMS: 1000000 - serverMonitoringMode: poll - appname: backpressureNetworkErrorFailTest - - database: - id: database - client: client - databaseName: sdam-tests - - collection: - id: collection - database: database - collectionName: backpressure-network-error-fail - - name: waitForEvent - object: testRunner - arguments: - client: client - event: - serverHeartbeatSucceededEvent: {} - count: 1 - - name: failPoint - object: testRunner - arguments: - client: setupClient - failPoint: - configureFailPoint: failCommand - mode: alwaysOn - data: - failCommands: - - isMaster - - hello - appName: backpressureNetworkErrorFailTest - closeConnection: true - - name: insertMany - object: collection - arguments: - documents: - - _id: 3 - - _id: 4 - expectError: - isError: true - errorLabelsContain: - - SystemOverloadedError - - RetryableError - expectEvents: - - client: client - eventType: cmap - events: [] diff --git a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-timeout-fail.json b/test/spec/server-discovery-and-monitoring/unified/backpressure-network-timeout-fail.json deleted file mode 100644 index a97c7a329ff..00000000000 --- a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-timeout-fail.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "description": "backpressure-network-timeout-error", - "schemaVersion": "1.17", - "runOnRequirements": [ - { - "minServerVersion": "4.4", - "serverless": "forbid", - "topologies": [ - "single", - "replicaset", - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "setupClient", - "useMultipleMongoses": false - } - } - ], - "initialData": [ - { - "collectionName": "backpressure-network-timeout-error", - "databaseName": "sdam-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "apply backpressure on network timeout error during connection establishment", - "operations": [ - { - "name": "createEntities", - "object": "testRunner", - "arguments": { - "entities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "serverDescriptionChangedEvent", - "poolClearedEvent" - ], - "uriOptions": { - "retryWrites": false, - "heartbeatFrequencyMS": 1000000, - "appname": "backpressureNetworkTimeoutErrorTest", - "serverMonitoringMode": "poll", - "connectTimeoutMS": 250, - "socketTimeoutMS": 250 - } - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "sdam-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "backpressure-network-timeout-error" - } - } - ] - } - }, - { - "name": "waitForEvent", - "object": "testRunner", - "arguments": { - "client": "client", - "event": { - "serverDescriptionChangedEvent": {} - }, - "count": 1 - } - }, - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "setupClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": "alwaysOn", - "data": { - "failCommands": [ - "isMaster", - "hello" - ], - "blockConnection": true, - "blockTimeMS": 500, - "appName": "backpressureNetworkTimeoutErrorTest" - } - } - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "SystemOverloadedError", - "RetryableError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [] - } - ] - } - ] -} diff --git a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-timeout-fail.yml b/test/spec/server-discovery-and-monitoring/unified/backpressure-network-timeout-fail.yml deleted file mode 100644 index 6a61eba3add..00000000000 --- a/test/spec/server-discovery-and-monitoring/unified/backpressure-network-timeout-fail.yml +++ /dev/null @@ -1,83 +0,0 @@ -description: backpressure-network-timeout-error -schemaVersion: "1.17" -runOnRequirements: - - minServerVersion: "4.4" - serverless: forbid - topologies: - - single - - replicaset - - sharded -createEntities: - - client: - id: setupClient - useMultipleMongoses: false -initialData: - - collectionName: backpressure-network-timeout-error - databaseName: sdam-tests - documents: - - _id: 1 - - _id: 2 -tests: - - description: apply backpressure on network timeout error during connection establishment - operations: - - name: createEntities - object: testRunner - arguments: - entities: - - client: - id: client - useMultipleMongoses: false - observeEvents: - - serverDescriptionChangedEvent - - poolClearedEvent - uriOptions: - retryWrites: false - heartbeatFrequencyMS: 1000000 - appname: backpressureNetworkTimeoutErrorTest - serverMonitoringMode: poll - connectTimeoutMS: 250 - socketTimeoutMS: 250 - - database: - id: database - client: client - databaseName: sdam-tests - - collection: - id: collection - database: database - collectionName: backpressure-network-timeout-error - - name: waitForEvent - object: testRunner - arguments: - client: client - event: - serverDescriptionChangedEvent: {} - count: 1 - - name: failPoint - object: testRunner - arguments: - client: setupClient - failPoint: - configureFailPoint: failCommand - mode: alwaysOn - data: - failCommands: - - isMaster - - hello - blockConnection: true - blockTimeMS: 500 - appName: backpressureNetworkTimeoutErrorTest - - name: insertMany - object: collection - arguments: - documents: - - _id: 3 - - _id: 4 - expectError: - isError: true - errorLabelsContain: - - SystemOverloadedError - - RetryableError - expectEvents: - - client: client - eventType: cmap - events: [] diff --git a/test/spec/transactions/unified/backpressure-retryable-abort.json b/test/spec/transactions/unified/backpressure-retryable-abort.json index 53fc9c6f090..3a2a3b43683 100644 --- a/test/spec/transactions/unified/backpressure-retryable-abort.json +++ b/test/spec/transactions/unified/backpressure-retryable-abort.json @@ -213,7 +213,7 @@ ] }, { - "description": "abortTransaction is retried maxAttempts=5 times if backpressure labels are added", + "description": "abortTransaction is retried maxAttempts=2 times if backpressure labels are added", "operations": [ { "object": "testRunner", @@ -322,21 +322,6 @@ "commandName": "abortTransaction" } }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - }, { "commandStartedEvent": { "commandName": "abortTransaction" diff --git a/test/spec/transactions/unified/backpressure-retryable-abort.yml b/test/spec/transactions/unified/backpressure-retryable-abort.yml index 85532e1f605..bd8180dd1fa 100644 --- a/test/spec/transactions/unified/backpressure-retryable-abort.yml +++ b/test/spec/transactions/unified/backpressure-retryable-abort.yml @@ -132,7 +132,7 @@ tests: - collectionName: *collection_name databaseName: *database_name documents: [] - - description: abortTransaction is retried maxAttempts=5 times if backpressure labels are added + - description: abortTransaction is retried maxAttempts=2 times if backpressure labels are added operations: - object: testRunner name: failPoint @@ -201,12 +201,6 @@ tests: commandName: abortTransaction - commandStartedEvent: commandName: abortTransaction - - commandStartedEvent: - commandName: abortTransaction - - commandStartedEvent: - commandName: abortTransaction - - commandStartedEvent: - commandName: abortTransaction outcome: - collectionName: *collection_name databaseName: *database_name diff --git a/test/spec/transactions/unified/backpressure-retryable-commit.json b/test/spec/transactions/unified/backpressure-retryable-commit.json index ae873561a99..844ed25ab45 100644 --- a/test/spec/transactions/unified/backpressure-retryable-commit.json +++ b/test/spec/transactions/unified/backpressure-retryable-commit.json @@ -222,7 +222,7 @@ ] }, { - "description": "commitTransaction is retried maxAttempts=5 times if backpressure labels are added", + "description": "commitTransaction is retried maxAttempts=2 times if backpressure labels are added", "runOnRequirements": [ { "serverless": "forbid" @@ -339,21 +339,6 @@ "commandName": "commitTransaction" } }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, { "commandStartedEvent": { "commandName": "commitTransaction" diff --git a/test/spec/transactions/unified/backpressure-retryable-commit.yml b/test/spec/transactions/unified/backpressure-retryable-commit.yml index 8099e1c1eba..8ee1b96c7f6 100644 --- a/test/spec/transactions/unified/backpressure-retryable-commit.yml +++ b/test/spec/transactions/unified/backpressure-retryable-commit.yml @@ -135,7 +135,7 @@ tests: databaseName: *database_name documents: - _id: 1 - - description: commitTransaction is retried maxAttempts=5 times if backpressure labels are added + - description: commitTransaction is retried maxAttempts=2 times if backpressure labels are added runOnRequirements: - serverless: forbid operations: @@ -208,12 +208,6 @@ tests: commandName: commitTransaction - commandStartedEvent: commandName: commitTransaction - - commandStartedEvent: - commandName: commitTransaction - - commandStartedEvent: - commandName: commitTransaction - - commandStartedEvent: - commandName: commitTransaction outcome: - collectionName: *collection_name databaseName: *database_name diff --git a/test/spec/transactions/unified/backpressure-retryable-reads.json b/test/spec/transactions/unified/backpressure-retryable-reads.json index 731762830e3..a859ec4bda7 100644 --- a/test/spec/transactions/unified/backpressure-retryable-reads.json +++ b/test/spec/transactions/unified/backpressure-retryable-reads.json @@ -216,7 +216,7 @@ ] }, { - "description": "reads are retried maxAttempts=5 times if backpressure labels are added", + "description": "reads are retried maxAttempts=2 times if backpressure labels are added", "operations": [ { "object": "session0", @@ -300,21 +300,6 @@ "commandName": "find" } }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, { "commandStartedEvent": { "commandName": "abortTransaction" diff --git a/test/spec/transactions/unified/backpressure-retryable-reads.yml b/test/spec/transactions/unified/backpressure-retryable-reads.yml index 18bbdaadbfa..7edc41fa47b 100644 --- a/test/spec/transactions/unified/backpressure-retryable-reads.yml +++ b/test/spec/transactions/unified/backpressure-retryable-reads.yml @@ -134,7 +134,7 @@ tests: $$exists: false commandName: commitTransaction databaseName: admin - - description: reads are retried maxAttempts=5 times if backpressure labels are added + - description: reads are retried maxAttempts=2 times if backpressure labels are added operations: - object: *session0 name: startTransaction @@ -182,11 +182,5 @@ tests: commandName: find - commandStartedEvent: commandName: find - - commandStartedEvent: - commandName: find - - commandStartedEvent: - commandName: find - - commandStartedEvent: - commandName: find - commandStartedEvent: commandName: abortTransaction diff --git a/test/spec/transactions/unified/backpressure-retryable-writes.json b/test/spec/transactions/unified/backpressure-retryable-writes.json index 0b07f80c588..6cbf450e5ff 100644 --- a/test/spec/transactions/unified/backpressure-retryable-writes.json +++ b/test/spec/transactions/unified/backpressure-retryable-writes.json @@ -244,7 +244,7 @@ ] }, { - "description": "writes are retried maxAttempts=5 times if backpressure labels are added", + "description": "writes are retried maxAttempts=2 times if backpressure labels are added", "operations": [ { "object": "session0", @@ -330,21 +330,6 @@ "commandName": "insert" } }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, { "commandStartedEvent": { "commandName": "abortTransaction" @@ -451,4 +436,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/test/spec/transactions/unified/backpressure-retryable-writes.yml b/test/spec/transactions/unified/backpressure-retryable-writes.yml index 157dc096c9a..68c86cff2b8 100644 --- a/test/spec/transactions/unified/backpressure-retryable-writes.yml +++ b/test/spec/transactions/unified/backpressure-retryable-writes.yml @@ -144,10 +144,10 @@ tests: outcome: - collectionName: *collection_name databaseName: *database_name - documents: + documents: - { _id: 1 } - { _id: 2 } - - description: writes are retried maxAttempts=5 times if backpressure labels are added + - description: writes are retried maxAttempts=2 times if backpressure labels are added operations: - object: *session0 name: startTransaction @@ -196,12 +196,6 @@ tests: commandName: insert - commandStartedEvent: commandName: insert - - commandStartedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - - commandStartedEvent: - commandName: insert - commandStartedEvent: commandName: abortTransaction outcome: @@ -257,4 +251,4 @@ tests: outcome: - collectionName: *collection_name databaseName: *database_name - documents: [] \ No newline at end of file + documents: [] diff --git a/test/spec/uri-options/client-backpressure-options.json b/test/spec/uri-options/client-backpressure-options.json index 73eed592a47..3e501d1f4c7 100644 --- a/test/spec/uri-options/client-backpressure-options.json +++ b/test/spec/uri-options/client-backpressure-options.json @@ -1,30 +1,61 @@ { "tests": [ { - "description": "adaptiveRetries=true is parsed correctly", - "uri": "mongodb://example.com/?adaptiveRetries=true", + "description": "maxAdaptiveRetries is parsed correctly", + "uri": "mongodb://example.com/?maxAdaptiveRetries=3", "valid": true, "warning": false, "hosts": null, "auth": null, "options": { - "adaptiveRetries": true + "maxAdaptiveRetries": 3 } }, { - "description": "adaptiveRetries=false is parsed correctly", - "uri": "mongodb://example.com/?adaptiveRetries=false", + "description": "maxAdaptiveRetries=0 is parsed correctly", + "uri": "mongodb://example.com/?maxAdaptiveRetries=0", "valid": true, "warning": false, "hosts": null, "auth": null, "options": { - "adaptiveRetries": false + "maxAdaptiveRetries": 0 } }, { - "description": "adaptiveRetries with invalid value causes a warning", - "uri": "mongodb://example.com/?adaptiveRetries=invalid", + "description": "maxAdaptiveRetries with invalid value causes a warning", + "uri": "mongodb://example.com/?maxAdaptiveRetries=-5", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": null + }, + { + "description": "enableOverloadRetargeting is parsed correctly", + "uri": "mongodb://example.com/?enableOverloadRetargeting=true", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "enableOverloadRetargeting": true + } + }, + { + "description": "enableOverloadRetargeting=false is parsed correctly", + "uri": "mongodb://example.com/?enableOverloadRetargeting=false", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "enableOverloadRetargeting": false + } + }, + { + "description": "enableOverloadRetargeting with invalid value causes a warning", + "uri": "mongodb://example.com/?enableOverloadRetargeting=invalid", "valid": true, "warning": true, "hosts": null, @@ -32,4 +63,4 @@ "options": null } ] -} \ No newline at end of file +} diff --git a/test/spec/uri-options/client-backpressure-options.yml b/test/spec/uri-options/client-backpressure-options.yml index 0bfd4453565..c750b32e23b 100644 --- a/test/spec/uri-options/client-backpressure-options.yml +++ b/test/spec/uri-options/client-backpressure-options.yml @@ -1,27 +1,53 @@ tests: - - - description: "adaptiveRetries=true is parsed correctly" - uri: "mongodb://example.com/?adaptiveRetries=true" - valid: true - warning: false - hosts: ~ - auth: ~ - options: - adaptiveRetries: true - - - description: "adaptiveRetries=false is parsed correctly" - uri: "mongodb://example.com/?adaptiveRetries=false" - valid: true - warning: false - hosts: ~ - auth: ~ - options: - adaptiveRetries: false - - - description: "adaptiveRetries with invalid value causes a warning" - uri: "mongodb://example.com/?adaptiveRetries=invalid" - valid: true - warning: true - hosts: ~ - auth: ~ - options: ~ \ No newline at end of file + - + description: "maxAdaptiveRetries is parsed correctly" + uri: "mongodb://example.com/?maxAdaptiveRetries=3" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + maxAdaptiveRetries: 3 + - + description: "maxAdaptiveRetries=0 is parsed correctly" + uri: "mongodb://example.com/?maxAdaptiveRetries=0" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + maxAdaptiveRetries: 0 + - + description: "maxAdaptiveRetries with invalid value causes a warning" + uri: "mongodb://example.com/?maxAdaptiveRetries=-5" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ + - + description: "enableOverloadRetargeting is parsed correctly" + uri: "mongodb://example.com/?enableOverloadRetargeting=true" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + enableOverloadRetargeting: true + - + description: "enableOverloadRetargeting=false is parsed correctly" + uri: "mongodb://example.com/?enableOverloadRetargeting=false" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + enableOverloadRetargeting: false + - + description: "enableOverloadRetargeting with invalid value causes a warning" + uri: "mongodb://example.com/?enableOverloadRetargeting=invalid" + valid: true + warning: true + hosts: ~ + auth: ~ + options: ~ diff --git a/test/tools/uri_spec_runner.ts b/test/tools/uri_spec_runner.ts index 3250944c673..cc419495c0f 100644 --- a/test/tools/uri_spec_runner.ts +++ b/test/tools/uri_spec_runner.ts @@ -358,7 +358,8 @@ export function executeUriValidationTest( case 'serverSelectionTimeoutMS': case 'serverMonitoringMode': case 'socketTimeoutMS': - case 'adaptiveRetries': + case 'maxAdaptiveRetries': + case 'enableOverloadRetargeting': case 'retryWrites': case 'directConnection': case 'loadBalanced': diff --git a/test/unit/connection_string.test.ts b/test/unit/connection_string.test.ts index 9486f1d3fa5..38b27318fd0 100644 --- a/test/unit/connection_string.test.ts +++ b/test/unit/connection_string.test.ts @@ -890,23 +890,4 @@ describe('Connection String', function () { } }); }); - - context('when adaptiveRetries is set', function () { - it('defaults to false', function () { - const options = parseOptions('mongodb://localhost:27017'); - expect(options.adaptiveRetries).to.equal(false); - }); - - it('can be enabled via connection string', function () { - const options = parseOptions('mongodb://localhost:27017?adaptiveRetries=true'); - expect(options.adaptiveRetries).to.equal(true); - }); - - it('can be enabled via client options', function () { - const options = parseOptions('mongodb://localhost:27017', { - adaptiveRetries: true - }); - expect(options.adaptiveRetries).to.equal(true); - }); - }); });