Skip to content

Commit 5786a46

Browse files
kkloberdanzjmikolakevinAlbs
authored
DRIVERS-1389 Make ExceededTimeLimit a retryable reads error (#1478)
See C Driver implementation for reference. mongodb/mongo-c-driver#1482 --------- Co-authored-by: Jeremy Mikola <[email protected]> Co-authored-by: Kevin Albertson <[email protected]>
1 parent 82da02b commit 5786a46

File tree

3 files changed

+218
-0
lines changed

3 files changed

+218
-0
lines changed

source/retryable-reads/retryable-reads.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ An error is considered retryable if it meets any of the following criteria:
5454
=============================== ==============
5555
**Error Name** **Error Code**
5656
=============================== ==============
57+
ExceededTimeLimit 262
5758
InterruptedAtShutdown 11600
5859
InterruptedDueToReplStateChange 11602
5960
NotWritablePrimary 10107
@@ -703,6 +704,8 @@ degraded performance can simply disable ``retryableReads``.
703704
Changelog
704705
=========
705706
707+
:2023-11-28: Add ExceededTimeLimit to the list of error codes that should
708+
be retried.
706709
:2023-08-26: Require that in a sharded cluster the server on which the
707710
operation failed MUST be provided to the server selection
708711
mechanism as a deprioritized server.

source/retryable-reads/tests/unified/exceededTimeLimit.json

Lines changed: 147 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
description: "ExceededTimeLimit is a retryable read"
2+
3+
schemaVersion: "1.3"
4+
5+
runOnRequirements:
6+
- minServerVersion: "4.0"
7+
topologies: [single, replicaset]
8+
- minServerVersion: "4.1.7"
9+
topologies: [sharded, load-balanced]
10+
11+
createEntities:
12+
- client:
13+
id: &client0 client0
14+
# Ensure the `configureFailpoint` and `find` commands are run on the same mongos
15+
useMultipleMongoses: false
16+
observeEvents: [ commandStartedEvent ]
17+
- database:
18+
id: &database0 database0
19+
client: *client0
20+
databaseName: &database0Name "retryable-reads-tests"
21+
- collection:
22+
id: &collection0 collection0
23+
database: *database0
24+
collectionName: &collection0Name "exceededtimelimit-test"
25+
26+
initialData:
27+
- collectionName: *collection0Name
28+
databaseName: *database0Name
29+
documents:
30+
- { _id: 1, x: 11 }
31+
- { _id: 2, x: 22 }
32+
- { _id: 3, x: 33 }
33+
34+
tests:
35+
- description: "Find succeeds on second attempt after ExceededTimeLimit"
36+
operations:
37+
- name: failPoint
38+
object: testRunner
39+
arguments:
40+
client: *client0
41+
failPoint:
42+
configureFailPoint: failCommand
43+
mode: { times: 1 }
44+
data:
45+
failCommands: [ "find" ]
46+
errorCode: 262 # ExceededTimeLimit
47+
- name: find
48+
arguments:
49+
filter: { _id: { $gt: 1 } }
50+
object: *collection0
51+
expectResult:
52+
- { _id: 2, x: 22 }
53+
- { _id: 3, x: 33 }
54+
expectEvents:
55+
- client: *client0
56+
events:
57+
- commandStartedEvent:
58+
command:
59+
find: *collection0Name
60+
filter: { _id: { $gt: 1 } }
61+
commandName: find
62+
databaseName: *database0Name
63+
- commandStartedEvent:
64+
command:
65+
find: *collection0Name
66+
filter: { _id: { $gt: 1 } }
67+
commandName: find
68+
databaseName: *database0Name

0 commit comments

Comments
 (0)