Skip to content

Commit

Permalink
DRIVERS-1389 Make ExceededTimeLimit a retryable reads error (#1478)
Browse files Browse the repository at this point in the history
See C Driver implementation for reference.
mongodb/mongo-c-driver#1482

---------

Co-authored-by: Jeremy Mikola <jmikola@gmail.com>
Co-authored-by: Kevin Albertson <kevin.albertson@10gen.com>
  • Loading branch information
3 people committed Nov 30, 2023
1 parent 82da02b commit 5786a46
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/retryable-reads/retryable-reads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ An error is considered retryable if it meets any of the following criteria:
=============================== ==============
**Error Name** **Error Code**
=============================== ==============
ExceededTimeLimit 262
InterruptedAtShutdown 11600
InterruptedDueToReplStateChange 11602
NotWritablePrimary 10107
Expand Down Expand Up @@ -703,6 +704,8 @@ degraded performance can simply disable ``retryableReads``.
Changelog
=========
: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
operation failed MUST be provided to the server selection
mechanism as a deprioritized server.
Expand Down
147 changes: 147 additions & 0 deletions source/retryable-reads/tests/unified/exceededTimeLimit.json

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

68 changes: 68 additions & 0 deletions source/retryable-reads/tests/unified/exceededTimeLimit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
description: "ExceededTimeLimit 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 "exceededtimelimit-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 ExceededTimeLimit"
operations:
- name: failPoint
object: testRunner
arguments:
client: *client0
failPoint:
configureFailPoint: failCommand
mode: { times: 1 }
data:
failCommands: [ "find" ]
errorCode: 262 # ExceededTimeLimit
- 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 5786a46

Please sign in to comment.