1{
2 "runOn": [
3 {
4 "minServerVersion": "4.0",
5 "topology": [
6 "replicaset"
7 ]
8 },
9 {
10 "minServerVersion": "4.1.8",
11 "topology": [
12 "sharded"
13 ]
14 }
15 ],
16 "database_name": "withTransaction-tests",
17 "collection_name": "test",
18 "data": [],
19 "tests": [
20 {
21 "description": "commitTransaction succeeds after multiple connection errors",
22 "failPoint": {
23 "configureFailPoint": "failCommand",
24 "mode": {
25 "times": 2
26 },
27 "data": {
28 "failCommands": [
29 "commitTransaction"
30 ],
31 "closeConnection": true
32 }
33 },
34 "operations": [
35 {
36 "name": "withTransaction",
37 "object": "session0",
38 "arguments": {
39 "callback": {
40 "operations": [
41 {
42 "name": "insertOne",
43 "object": "collection",
44 "arguments": {
45 "session": "session0",
46 "document": {
47 "_id": 1
48 }
49 },
50 "result": {
51 "insertedId": 1
52 }
53 }
54 ]
55 }
56 }
57 }
58 ],
59 "expectations": [
60 {
61 "command_started_event": {
62 "command": {
63 "insert": "test",
64 "documents": [
65 {
66 "_id": 1
67 }
68 ],
69 "ordered": true,
70 "lsid": "session0",
71 "txnNumber": {
72 "$numberLong": "1"
73 },
74 "startTransaction": true,
75 "autocommit": false,
76 "readConcern": null,
77 "writeConcern": null
78 },
79 "command_name": "insert",
80 "database_name": "withTransaction-tests"
81 }
82 },
83 {
84 "command_started_event": {
85 "command": {
86 "commitTransaction": 1,
87 "lsid": "session0",
88 "txnNumber": {
89 "$numberLong": "1"
90 },
91 "autocommit": false,
92 "readConcern": null,
93 "startTransaction": null,
94 "writeConcern": null
95 },
96 "command_name": "commitTransaction",
97 "database_name": "admin"
98 }
99 },
100 {
101 "command_started_event": {
102 "command": {
103 "commitTransaction": 1,
104 "lsid": "session0",
105 "txnNumber": {
106 "$numberLong": "1"
107 },
108 "autocommit": false,
109 "writeConcern": {
110 "w": "majority",
111 "wtimeout": 10000
112 },
113 "readConcern": null,
114 "startTransaction": null
115 },
116 "command_name": "commitTransaction",
117 "database_name": "admin"
118 }
119 },
120 {
121 "command_started_event": {
122 "command": {
123 "commitTransaction": 1,
124 "lsid": "session0",
125 "txnNumber": {
126 "$numberLong": "1"
127 },
128 "autocommit": false,
129 "writeConcern": {
130 "w": "majority",
131 "wtimeout": 10000
132 },
133 "readConcern": null,
134 "startTransaction": null
135 },
136 "command_name": "commitTransaction",
137 "database_name": "admin"
138 }
139 }
140 ],
141 "outcome": {
142 "collection": {
143 "data": [
144 {
145 "_id": 1
146 }
147 ]
148 }
149 }
150 },
151 {
152 "description": "commitTransaction retry only overwrites write concern w option",
153 "failPoint": {
154 "configureFailPoint": "failCommand",
155 "mode": {
156 "times": 2
157 },
158 "data": {
159 "failCommands": [
160 "commitTransaction"
161 ],
162 "closeConnection": true
163 }
164 },
165 "operations": [
166 {
167 "name": "withTransaction",
168 "object": "session0",
169 "arguments": {
170 "callback": {
171 "operations": [
172 {
173 "name": "insertOne",
174 "object": "collection",
175 "arguments": {
176 "session": "session0",
177 "document": {
178 "_id": 1
179 }
180 },
181 "result": {
182 "insertedId": 1
183 }
184 }
185 ]
186 },
187 "options": {
188 "writeConcern": {
189 "w": 2,
190 "j": true,
191 "wtimeout": 5000
192 }
193 }
194 }
195 }
196 ],
197 "expectations": [
198 {
199 "command_started_event": {
200 "command": {
201 "insert": "test",
202 "documents": [
203 {
204 "_id": 1
205 }
206 ],
207 "ordered": true,
208 "lsid": "session0",
209 "txnNumber": {
210 "$numberLong": "1"
211 },
212 "startTransaction": true,
213 "autocommit": false,
214 "readConcern": null,
215 "writeConcern": null
216 },
217 "command_name": "insert",
218 "database_name": "withTransaction-tests"
219 }
220 },
221 {
222 "command_started_event": {
223 "command": {
224 "commitTransaction": 1,
225 "lsid": "session0",
226 "txnNumber": {
227 "$numberLong": "1"
228 },
229 "autocommit": false,
230 "writeConcern": {
231 "w": 2,
232 "j": true,
233 "wtimeout": 5000
234 },
235 "readConcern": null,
236 "startTransaction": null
237 },
238 "command_name": "commitTransaction",
239 "database_name": "admin"
240 }
241 },
242 {
243 "command_started_event": {
244 "command": {
245 "commitTransaction": 1,
246 "lsid": "session0",
247 "txnNumber": {
248 "$numberLong": "1"
249 },
250 "autocommit": false,
251 "writeConcern": {
252 "w": "majority",
253 "j": true,
254 "wtimeout": 5000
255 },
256 "readConcern": null,
257 "startTransaction": null
258 },
259 "command_name": "commitTransaction",
260 "database_name": "admin"
261 }
262 },
263 {
264 "command_started_event": {
265 "command": {
266 "commitTransaction": 1,
267 "lsid": "session0",
268 "txnNumber": {
269 "$numberLong": "1"
270 },
271 "autocommit": false,
272 "writeConcern": {
273 "w": "majority",
274 "j": true,
275 "wtimeout": 5000
276 },
277 "readConcern": null,
278 "startTransaction": null
279 },
280 "command_name": "commitTransaction",
281 "database_name": "admin"
282 }
283 }
284 ],
285 "outcome": {
286 "collection": {
287 "data": [
288 {
289 "_id": 1
290 }
291 ]
292 }
293 }
294 },
295 {
296 "description": "commit is retried after commitTransaction UnknownTransactionCommitResult (NotWritablePrimary)",
297 "failPoint": {
298 "configureFailPoint": "failCommand",
299 "mode": {
300 "times": 2
301 },
302 "data": {
303 "failCommands": [
304 "commitTransaction"
305 ],
306 "errorCode": 10107,
307 "errorLabels": [
308 "RetryableWriteError"
309 ],
310 "closeConnection": false
311 }
312 },
313 "operations": [
314 {
315 "name": "withTransaction",
316 "object": "session0",
317 "arguments": {
318 "callback": {
319 "operations": [
320 {
321 "name": "insertOne",
322 "object": "collection",
323 "arguments": {
324 "session": "session0",
325 "document": {
326 "_id": 1
327 }
328 },
329 "result": {
330 "insertedId": 1
331 }
332 }
333 ]
334 }
335 }
336 }
337 ],
338 "expectations": [
339 {
340 "command_started_event": {
341 "command": {
342 "insert": "test",
343 "documents": [
344 {
345 "_id": 1
346 }
347 ],
348 "ordered": true,
349 "lsid": "session0",
350 "txnNumber": {
351 "$numberLong": "1"
352 },
353 "startTransaction": true,
354 "autocommit": false,
355 "readConcern": null,
356 "writeConcern": null
357 },
358 "command_name": "insert",
359 "database_name": "withTransaction-tests"
360 }
361 },
362 {
363 "command_started_event": {
364 "command": {
365 "commitTransaction": 1,
366 "lsid": "session0",
367 "txnNumber": {
368 "$numberLong": "1"
369 },
370 "autocommit": false,
371 "readConcern": null,
372 "startTransaction": null,
373 "writeConcern": null
374 },
375 "command_name": "commitTransaction",
376 "database_name": "admin"
377 }
378 },
379 {
380 "command_started_event": {
381 "command": {
382 "commitTransaction": 1,
383 "lsid": "session0",
384 "txnNumber": {
385 "$numberLong": "1"
386 },
387 "autocommit": false,
388 "writeConcern": {
389 "w": "majority",
390 "wtimeout": 10000
391 },
392 "readConcern": null,
393 "startTransaction": null
394 },
395 "command_name": "commitTransaction",
396 "database_name": "admin"
397 }
398 },
399 {
400 "command_started_event": {
401 "command": {
402 "commitTransaction": 1,
403 "lsid": "session0",
404 "txnNumber": {
405 "$numberLong": "1"
406 },
407 "autocommit": false,
408 "writeConcern": {
409 "w": "majority",
410 "wtimeout": 10000
411 },
412 "readConcern": null,
413 "startTransaction": null
414 },
415 "command_name": "commitTransaction",
416 "database_name": "admin"
417 }
418 }
419 ],
420 "outcome": {
421 "collection": {
422 "data": [
423 {
424 "_id": 1
425 }
426 ]
427 }
428 }
429 },
430 {
431 "description": "commit is not retried after MaxTimeMSExpired error",
432 "failPoint": {
433 "configureFailPoint": "failCommand",
434 "mode": {
435 "times": 1
436 },
437 "data": {
438 "failCommands": [
439 "commitTransaction"
440 ],
441 "errorCode": 50
442 }
443 },
444 "operations": [
445 {
446 "name": "withTransaction",
447 "object": "session0",
448 "arguments": {
449 "callback": {
450 "operations": [
451 {
452 "name": "insertOne",
453 "object": "collection",
454 "arguments": {
455 "session": "session0",
456 "document": {
457 "_id": 1
458 }
459 },
460 "result": {
461 "insertedId": 1
462 }
463 }
464 ]
465 },
466 "options": {
467 "maxCommitTimeMS": 60000
468 }
469 },
470 "result": {
471 "errorCodeName": "MaxTimeMSExpired",
472 "errorLabelsContain": [
473 "UnknownTransactionCommitResult"
474 ],
475 "errorLabelsOmit": [
476 "TransientTransactionError"
477 ]
478 }
479 }
480 ],
481 "expectations": [
482 {
483 "command_started_event": {
484 "command": {
485 "insert": "test",
486 "documents": [
487 {
488 "_id": 1
489 }
490 ],
491 "ordered": true,
492 "lsid": "session0",
493 "txnNumber": {
494 "$numberLong": "1"
495 },
496 "startTransaction": true,
497 "autocommit": false,
498 "readConcern": null,
499 "writeConcern": null
500 },
501 "command_name": "insert",
502 "database_name": "withTransaction-tests"
503 }
504 },
505 {
506 "command_started_event": {
507 "command": {
508 "commitTransaction": 1,
509 "lsid": "session0",
510 "txnNumber": {
511 "$numberLong": "1"
512 },
513 "autocommit": false,
514 "maxTimeMS": 60000,
515 "readConcern": null,
516 "startTransaction": null,
517 "writeConcern": null
518 },
519 "command_name": "commitTransaction",
520 "database_name": "admin"
521 }
522 }
523 ],
524 "outcome": {
525 "collection": {
526 "data": []
527 }
528 }
529 }
530 ]
531}
View as plain text