Skip to content

Commit 9d9d996

Browse files
authored
CDRIVER-4751 Make ExceededTimeLimit a retryable read error (#1482)
1 parent 5e27ad6 commit 9d9d996

File tree

3 files changed

+318
-0
lines changed

3 files changed

+318
-0
lines changed

src/libmongoc/src/mongoc/mongoc-error.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ _mongoc_read_error_get_type (bool cmd_ret,
184184
}
185185

186186
switch (error.code) {
187+
case MONGOC_SERVER_ERR_EXCEEDEDTIMELIMIT:
187188
case MONGOC_SERVER_ERR_INTERRUPTEDATSHUTDOWN:
188189
case MONGOC_SERVER_ERR_INTERRUPTEDDUETOREPLSTATECHANGE:
189190
case MONGOC_SERVER_ERR_NOTPRIMARY:
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"description": "ExceededTimeLimit is a retryable read",
3+
"schemaVersion": "1.3",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.2",
7+
"topologies": [
8+
"replicaset",
9+
"sharded",
10+
"load-balanced"
11+
],
12+
"auth": true
13+
}
14+
],
15+
"createEntities": [
16+
{
17+
"client": {
18+
"id": "client0",
19+
"useMultipleMongoses": false,
20+
"observeEvents": [
21+
"commandStartedEvent"
22+
]
23+
}
24+
},
25+
{
26+
"database": {
27+
"id": "database0",
28+
"client": "client0",
29+
"databaseName": "find-tests"
30+
}
31+
},
32+
{
33+
"collection": {
34+
"id": "collection0",
35+
"database": "database0",
36+
"collectionName": "coll0"
37+
}
38+
}
39+
],
40+
"initialData": [
41+
{
42+
"collectionName": "coll0",
43+
"databaseName": "find-tests",
44+
"documents": [
45+
{
46+
"_id": 1,
47+
"x": 11
48+
},
49+
{
50+
"_id": 2,
51+
"x": 22
52+
},
53+
{
54+
"_id": 3,
55+
"x": 33
56+
},
57+
{
58+
"_id": 4,
59+
"x": 44
60+
},
61+
{
62+
"_id": 5,
63+
"x": 55
64+
},
65+
{
66+
"_id": 6,
67+
"x": 66
68+
}
69+
]
70+
}
71+
],
72+
"tests": [
73+
{
74+
"description": "Find succeeds on second attempt after ExceededTimeLimit",
75+
"operations": [
76+
{
77+
"name": "failPoint",
78+
"object": "testRunner",
79+
"arguments": {
80+
"client": "client0",
81+
"failPoint": {
82+
"configureFailPoint": "failCommand",
83+
"mode": {
84+
"times": 1
85+
},
86+
"data": {
87+
"failCommands": [
88+
"find"
89+
],
90+
"closeConnection": false,
91+
"errorCode": 262
92+
}
93+
}
94+
}
95+
},
96+
{
97+
"name": "find",
98+
"arguments": {
99+
"filter": {
100+
"_id": {
101+
"$gt": 1
102+
}
103+
},
104+
"batchSize": 10
105+
},
106+
"object": "collection0",
107+
"expectResult": [
108+
{
109+
"_id": 2,
110+
"x": 22
111+
},
112+
{
113+
"_id": 3,
114+
"x": 33
115+
},
116+
{
117+
"_id": 4,
118+
"x": 44
119+
},
120+
{
121+
"_id": 5,
122+
"x": 55
123+
},
124+
{
125+
"_id": 6,
126+
"x": 66
127+
}
128+
]
129+
}
130+
],
131+
"expectEvents": [
132+
{
133+
"client": "client0",
134+
"events": [
135+
{
136+
"commandStartedEvent": {
137+
"command": {
138+
"find": "coll0",
139+
"filter": {
140+
"_id": {
141+
"$gt": 1
142+
}
143+
},
144+
"batchSize": 10
145+
},
146+
"commandName": "find",
147+
"databaseName": "find-tests"
148+
}
149+
},
150+
{
151+
"commandStartedEvent": {
152+
"command": {
153+
"find": "coll0",
154+
"filter": {
155+
"_id": {
156+
"$gt": 1
157+
}
158+
},
159+
"batchSize": 10
160+
},
161+
"commandName": "find",
162+
"databaseName": "find-tests"
163+
}
164+
}
165+
]
166+
}
167+
]
168+
}
169+
]
170+
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"description": "ExceededTimeLimit is a retryable read",
3+
"schemaVersion": "1.3",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.0",
7+
"topologies": [
8+
"single",
9+
"replicaset"
10+
]
11+
},
12+
{
13+
"minServerVersion": "4.1.7",
14+
"topologies": [
15+
"sharded",
16+
"load-balanced"
17+
]
18+
}
19+
],
20+
"createEntities": [
21+
{
22+
"client": {
23+
"id": "client0",
24+
"useMultipleMongoses": false,
25+
"observeEvents": [
26+
"commandStartedEvent"
27+
]
28+
}
29+
},
30+
{
31+
"database": {
32+
"id": "database0",
33+
"client": "client0",
34+
"databaseName": "retryable-reads-tests"
35+
}
36+
},
37+
{
38+
"collection": {
39+
"id": "collection0",
40+
"database": "database0",
41+
"collectionName": "exceededtimelimit-test"
42+
}
43+
}
44+
],
45+
"initialData": [
46+
{
47+
"collectionName": "exceededtimelimit-test",
48+
"databaseName": "retryable-reads-tests",
49+
"documents": [
50+
{
51+
"_id": 1,
52+
"x": 11
53+
},
54+
{
55+
"_id": 2,
56+
"x": 22
57+
},
58+
{
59+
"_id": 3,
60+
"x": 33
61+
}
62+
]
63+
}
64+
],
65+
"tests": [
66+
{
67+
"description": "Find succeeds on second attempt after ExceededTimeLimit",
68+
"operations": [
69+
{
70+
"name": "failPoint",
71+
"object": "testRunner",
72+
"arguments": {
73+
"client": "client0",
74+
"failPoint": {
75+
"configureFailPoint": "failCommand",
76+
"mode": {
77+
"times": 1
78+
},
79+
"data": {
80+
"failCommands": [
81+
"find"
82+
],
83+
"errorCode": 262
84+
}
85+
}
86+
}
87+
},
88+
{
89+
"name": "find",
90+
"arguments": {
91+
"filter": {
92+
"_id": {
93+
"$gt": 1
94+
}
95+
}
96+
},
97+
"object": "collection0",
98+
"expectResult": [
99+
{
100+
"_id": 2,
101+
"x": 22
102+
},
103+
{
104+
"_id": 3,
105+
"x": 33
106+
}
107+
]
108+
}
109+
],
110+
"expectEvents": [
111+
{
112+
"client": "client0",
113+
"events": [
114+
{
115+
"commandStartedEvent": {
116+
"command": {
117+
"find": "exceededtimelimit-test",
118+
"filter": {
119+
"_id": {
120+
"$gt": 1
121+
}
122+
}
123+
},
124+
"commandName": "find",
125+
"databaseName": "retryable-reads-tests"
126+
}
127+
},
128+
{
129+
"commandStartedEvent": {
130+
"command": {
131+
"find": "exceededtimelimit-test",
132+
"filter": {
133+
"_id": {
134+
"$gt": 1
135+
}
136+
}
137+
},
138+
"commandName": "find",
139+
"databaseName": "retryable-reads-tests"
140+
}
141+
}
142+
]
143+
}
144+
]
145+
}
146+
]
147+
}

0 commit comments

Comments
 (0)