Skip to content

Commit

Permalink
DRIVERS-926 Make ReadConcernMajorityNotAvailableYet a retryable read …
Browse files Browse the repository at this point in the history
…error
  • Loading branch information
kkloberdanz committed Dec 1, 2023
1 parent 5786a46 commit cb8e6b7
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 16 deletions.
35 changes: 19 additions & 16 deletions source/retryable-reads/retryable-reads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,23 @@ An error is considered retryable if it meets any of the following criteria:

- a server error response with any the following codes:

=============================== ==============
**Error Name** **Error Code**
=============================== ==============
ExceededTimeLimit 262
InterruptedAtShutdown 11600
InterruptedDueToReplStateChange 11602
NotWritablePrimary 10107
NotPrimaryNoSecondaryOk 13435
NotPrimaryOrSecondary 13436
PrimarySteppedDown 189
ShutdownInProgress 91
HostNotFound 7
HostUnreachable 6
NetworkTimeout 89
SocketException 9001
=============================== ==============
================================== ==============
**Error Name** **Error Code**
================================== ==============
ExceededTimeLimit 262
InterruptedAtShutdown 11600
InterruptedDueToReplStateChange 11602
NotWritablePrimary 10107
NotPrimaryNoSecondaryOk 13435
NotPrimaryOrSecondary 13436
PrimarySteppedDown 189
ReadConcernMajorityNotAvailableYet 134
ShutdownInProgress 91
HostNotFound 7
HostUnreachable 6
NetworkTimeout 89
SocketException 9001
================================== ==============

- a `PoolClearedError`_

Expand Down Expand Up @@ -704,6 +705,8 @@ degraded performance can simply disable ``retryableReads``.
Changelog
=========
:2023-11-30: Add to ReadConcernMajorityNotAvailableYet the list of error codes
that should be retried.
:2023-11-28: Add ExceededTimeLimit to the list of error codes that should
be retried.
:2023-08-26: Require that in a sharded cluster the server on which the
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
description: "ReadConcernMajorityNotAvailableYet is a retryable read"

schemaVersion: "1.3"

runOnRequirements:
- minServerVersion: "4.0"
topologies: [single, replicaset]
- minServerVersion: "4.1.7"
topologies: [sharded, load-balanced]

createEntities:
- client:
id: &client0 client0
# Ensure the `configureFailpoint` and `find` commands are run on the same mongos
useMultipleMongoses: false
observeEvents: [ commandStartedEvent ]
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name "retryable-reads-tests"
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name "readconcernmajoritynotavailableyet_test"

initialData:
- collectionName: *collection0Name
databaseName: *database0Name
documents:
- { _id: 1, x: 11 }
- { _id: 2, x: 22 }
- { _id: 3, x: 33 }

tests:
- description: "Find succeeds on second attempt after ReadConcernMajorityNotAvailableYet"
operations:
- name: failPoint
object: testRunner
arguments:
client: *client0
failPoint:
configureFailPoint: failCommand
mode: { times: 1 }
data:
failCommands: [ "find" ]
errorCode: 134 # ReadConcernMajorityNotAvailableYet
- name: find
arguments:
filter: { _id: { $gt: 1 } }
object: *collection0
expectResult:
- { _id: 2, x: 22 }
- { _id: 3, x: 33 }
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
find: *collection0Name
filter: { _id: { $gt: 1 } }
commandName: find
databaseName: *database0Name
- commandStartedEvent:
command:
find: *collection0Name
filter: { _id: { $gt: 1 } }
commandName: find
databaseName: *database0Name

0 comments on commit cb8e6b7

Please sign in to comment.