1{
2 "runOn": [
3 {
4 "minServerVersion": "3.6",
5 "topology": [
6 "replicaset"
7 ]
8 }
9 ],
10 "data": [
11 {
12 "_id": 1,
13 "x": 11
14 }
15 ],
16 "tests": [
17 {
18 "description": "First command is retried",
19 "failPoint": {
20 "configureFailPoint": "onPrimaryTransactionalWrite",
21 "mode": {
22 "times": 1
23 }
24 },
25 "operation": {
26 "name": "bulkWrite",
27 "arguments": {
28 "requests": [
29 {
30 "name": "insertOne",
31 "arguments": {
32 "document": {
33 "_id": 2,
34 "x": 22
35 }
36 }
37 },
38 {
39 "name": "updateOne",
40 "arguments": {
41 "filter": {
42 "_id": 2
43 },
44 "update": {
45 "$inc": {
46 "x": 1
47 }
48 }
49 }
50 },
51 {
52 "name": "deleteOne",
53 "arguments": {
54 "filter": {
55 "_id": 1
56 }
57 }
58 }
59 ],
60 "options": {
61 "ordered": true
62 }
63 }
64 },
65 "outcome": {
66 "result": {
67 "deletedCount": 1,
68 "insertedCount": 1,
69 "insertedIds": {
70 "0": 2
71 },
72 "matchedCount": 1,
73 "modifiedCount": 1,
74 "upsertedCount": 0,
75 "upsertedIds": {}
76 },
77 "collection": {
78 "data": [
79 {
80 "_id": 2,
81 "x": 23
82 }
83 ]
84 }
85 }
86 },
87 {
88 "description": "All commands are retried",
89 "failPoint": {
90 "configureFailPoint": "onPrimaryTransactionalWrite",
91 "mode": {
92 "times": 7
93 }
94 },
95 "operation": {
96 "name": "bulkWrite",
97 "arguments": {
98 "requests": [
99 {
100 "name": "insertOne",
101 "arguments": {
102 "document": {
103 "_id": 2,
104 "x": 22
105 }
106 }
107 },
108 {
109 "name": "updateOne",
110 "arguments": {
111 "filter": {
112 "_id": 2
113 },
114 "update": {
115 "$inc": {
116 "x": 1
117 }
118 }
119 }
120 },
121 {
122 "name": "insertOne",
123 "arguments": {
124 "document": {
125 "_id": 3,
126 "x": 33
127 }
128 }
129 },
130 {
131 "name": "updateOne",
132 "arguments": {
133 "filter": {
134 "_id": 4,
135 "x": 44
136 },
137 "update": {
138 "$inc": {
139 "x": 1
140 }
141 },
142 "upsert": true
143 }
144 },
145 {
146 "name": "insertOne",
147 "arguments": {
148 "document": {
149 "_id": 5,
150 "x": 55
151 }
152 }
153 },
154 {
155 "name": "replaceOne",
156 "arguments": {
157 "filter": {
158 "_id": 3
159 },
160 "replacement": {
161 "_id": 3,
162 "x": 333
163 }
164 }
165 },
166 {
167 "name": "deleteOne",
168 "arguments": {
169 "filter": {
170 "_id": 1
171 }
172 }
173 }
174 ],
175 "options": {
176 "ordered": true
177 }
178 }
179 },
180 "outcome": {
181 "result": {
182 "deletedCount": 1,
183 "insertedCount": 3,
184 "insertedIds": {
185 "0": 2,
186 "2": 3,
187 "4": 5
188 },
189 "matchedCount": 2,
190 "modifiedCount": 2,
191 "upsertedCount": 1,
192 "upsertedIds": {
193 "3": 4
194 }
195 },
196 "collection": {
197 "data": [
198 {
199 "_id": 2,
200 "x": 23
201 },
202 {
203 "_id": 3,
204 "x": 333
205 },
206 {
207 "_id": 4,
208 "x": 45
209 },
210 {
211 "_id": 5,
212 "x": 55
213 }
214 ]
215 }
216 }
217 },
218 {
219 "description": "Both commands are retried after their first statement fails",
220 "failPoint": {
221 "configureFailPoint": "onPrimaryTransactionalWrite",
222 "mode": {
223 "times": 2
224 }
225 },
226 "operation": {
227 "name": "bulkWrite",
228 "arguments": {
229 "requests": [
230 {
231 "name": "insertOne",
232 "arguments": {
233 "document": {
234 "_id": 2,
235 "x": 22
236 }
237 }
238 },
239 {
240 "name": "updateOne",
241 "arguments": {
242 "filter": {
243 "_id": 1
244 },
245 "update": {
246 "$inc": {
247 "x": 1
248 }
249 }
250 }
251 },
252 {
253 "name": "updateOne",
254 "arguments": {
255 "filter": {
256 "_id": 2
257 },
258 "update": {
259 "$inc": {
260 "x": 1
261 }
262 }
263 }
264 }
265 ],
266 "options": {
267 "ordered": true
268 }
269 }
270 },
271 "outcome": {
272 "result": {
273 "deletedCount": 0,
274 "insertedCount": 1,
275 "insertedIds": {
276 "0": 2
277 },
278 "matchedCount": 2,
279 "modifiedCount": 2,
280 "upsertedCount": 0,
281 "upsertedIds": {}
282 },
283 "collection": {
284 "data": [
285 {
286 "_id": 1,
287 "x": 12
288 },
289 {
290 "_id": 2,
291 "x": 23
292 }
293 ]
294 }
295 }
296 },
297 {
298 "description": "Second command is retried after its second statement fails",
299 "failPoint": {
300 "configureFailPoint": "onPrimaryTransactionalWrite",
301 "mode": {
302 "skip": 2
303 }
304 },
305 "operation": {
306 "name": "bulkWrite",
307 "arguments": {
308 "requests": [
309 {
310 "name": "insertOne",
311 "arguments": {
312 "document": {
313 "_id": 2,
314 "x": 22
315 }
316 }
317 },
318 {
319 "name": "updateOne",
320 "arguments": {
321 "filter": {
322 "_id": 1
323 },
324 "update": {
325 "$inc": {
326 "x": 1
327 }
328 }
329 }
330 },
331 {
332 "name": "updateOne",
333 "arguments": {
334 "filter": {
335 "_id": 2
336 },
337 "update": {
338 "$inc": {
339 "x": 1
340 }
341 }
342 }
343 }
344 ],
345 "options": {
346 "ordered": true
347 }
348 }
349 },
350 "outcome": {
351 "result": {
352 "deletedCount": 0,
353 "insertedCount": 1,
354 "insertedIds": {
355 "0": 2
356 },
357 "matchedCount": 2,
358 "modifiedCount": 2,
359 "upsertedCount": 0,
360 "upsertedIds": {}
361 },
362 "collection": {
363 "data": [
364 {
365 "_id": 1,
366 "x": 12
367 },
368 {
369 "_id": 2,
370 "x": 23
371 }
372 ]
373 }
374 }
375 },
376 {
377 "description": "BulkWrite with unordered execution",
378 "failPoint": {
379 "configureFailPoint": "onPrimaryTransactionalWrite",
380 "mode": {
381 "times": 1
382 }
383 },
384 "operation": {
385 "name": "bulkWrite",
386 "arguments": {
387 "requests": [
388 {
389 "name": "insertOne",
390 "arguments": {
391 "document": {
392 "_id": 2,
393 "x": 22
394 }
395 }
396 },
397 {
398 "name": "insertOne",
399 "arguments": {
400 "document": {
401 "_id": 3,
402 "x": 33
403 }
404 }
405 }
406 ],
407 "options": {
408 "ordered": false
409 }
410 }
411 },
412 "outcome": {
413 "result": {
414 "deletedCount": 0,
415 "insertedCount": 2,
416 "insertedIds": {
417 "0": 2,
418 "1": 3
419 },
420 "matchedCount": 0,
421 "modifiedCount": 0,
422 "upsertedCount": 0,
423 "upsertedIds": {}
424 },
425 "collection": {
426 "data": [
427 {
428 "_id": 1,
429 "x": 11
430 },
431 {
432 "_id": 2,
433 "x": 22
434 },
435 {
436 "_id": 3,
437 "x": 33
438 }
439 ]
440 }
441 }
442 },
443 {
444 "description": "First insertOne is never committed",
445 "failPoint": {
446 "configureFailPoint": "onPrimaryTransactionalWrite",
447 "mode": {
448 "times": 2
449 },
450 "data": {
451 "failBeforeCommitExceptionCode": 1
452 }
453 },
454 "operation": {
455 "name": "bulkWrite",
456 "arguments": {
457 "requests": [
458 {
459 "name": "insertOne",
460 "arguments": {
461 "document": {
462 "_id": 2,
463 "x": 22
464 }
465 }
466 },
467 {
468 "name": "updateOne",
469 "arguments": {
470 "filter": {
471 "_id": 2
472 },
473 "update": {
474 "$inc": {
475 "x": 1
476 }
477 }
478 }
479 },
480 {
481 "name": "deleteOne",
482 "arguments": {
483 "filter": {
484 "_id": 1
485 }
486 }
487 }
488 ],
489 "options": {
490 "ordered": true
491 }
492 }
493 },
494 "outcome": {
495 "error": true,
496 "result": {
497 "deletedCount": 0,
498 "insertedCount": 0,
499 "insertedIds": {},
500 "matchedCount": 0,
501 "modifiedCount": 0,
502 "upsertedCount": 0,
503 "upsertedIds": {}
504 },
505 "collection": {
506 "data": [
507 {
508 "_id": 1,
509 "x": 11
510 }
511 ]
512 }
513 }
514 },
515 {
516 "description": "Second updateOne is never committed",
517 "failPoint": {
518 "configureFailPoint": "onPrimaryTransactionalWrite",
519 "mode": {
520 "skip": 1
521 },
522 "data": {
523 "failBeforeCommitExceptionCode": 1
524 }
525 },
526 "operation": {
527 "name": "bulkWrite",
528 "arguments": {
529 "requests": [
530 {
531 "name": "insertOne",
532 "arguments": {
533 "document": {
534 "_id": 2,
535 "x": 22
536 }
537 }
538 },
539 {
540 "name": "updateOne",
541 "arguments": {
542 "filter": {
543 "_id": 2
544 },
545 "update": {
546 "$inc": {
547 "x": 1
548 }
549 }
550 }
551 },
552 {
553 "name": "deleteOne",
554 "arguments": {
555 "filter": {
556 "_id": 1
557 }
558 }
559 }
560 ],
561 "options": {
562 "ordered": true
563 }
564 }
565 },
566 "outcome": {
567 "error": true,
568 "result": {
569 "deletedCount": 0,
570 "insertedCount": 1,
571 "insertedIds": {
572 "0": 2
573 },
574 "matchedCount": 0,
575 "modifiedCount": 0,
576 "upsertedCount": 0,
577 "upsertedIds": {}
578 },
579 "collection": {
580 "data": [
581 {
582 "_id": 1,
583 "x": 11
584 },
585 {
586 "_id": 2,
587 "x": 22
588 }
589 ]
590 }
591 }
592 },
593 {
594 "description": "Third updateOne is never committed",
595 "failPoint": {
596 "configureFailPoint": "onPrimaryTransactionalWrite",
597 "mode": {
598 "skip": 2
599 },
600 "data": {
601 "failBeforeCommitExceptionCode": 1
602 }
603 },
604 "operation": {
605 "name": "bulkWrite",
606 "arguments": {
607 "requests": [
608 {
609 "name": "updateOne",
610 "arguments": {
611 "filter": {
612 "_id": 1
613 },
614 "update": {
615 "$inc": {
616 "x": 1
617 }
618 }
619 }
620 },
621 {
622 "name": "insertOne",
623 "arguments": {
624 "document": {
625 "_id": 2,
626 "x": 22
627 }
628 }
629 },
630 {
631 "name": "updateOne",
632 "arguments": {
633 "filter": {
634 "_id": 2
635 },
636 "update": {
637 "$inc": {
638 "x": 1
639 }
640 }
641 }
642 }
643 ],
644 "options": {
645 "ordered": true
646 }
647 }
648 },
649 "outcome": {
650 "error": true,
651 "result": {
652 "deletedCount": 0,
653 "insertedCount": 1,
654 "insertedIds": {
655 "1": 2
656 },
657 "matchedCount": 1,
658 "modifiedCount": 1,
659 "upsertedCount": 0,
660 "upsertedIds": {}
661 },
662 "collection": {
663 "data": [
664 {
665 "_id": 1,
666 "x": 12
667 },
668 {
669 "_id": 2,
670 "x": 22
671 }
672 ]
673 }
674 }
675 },
676 {
677 "description": "Single-document write following deleteMany is retried",
678 "failPoint": {
679 "configureFailPoint": "onPrimaryTransactionalWrite",
680 "mode": {
681 "times": 1
682 },
683 "data": {
684 "failBeforeCommitExceptionCode": 1
685 }
686 },
687 "operation": {
688 "name": "bulkWrite",
689 "arguments": {
690 "requests": [
691 {
692 "name": "deleteMany",
693 "arguments": {
694 "filter": {
695 "x": 11
696 }
697 }
698 },
699 {
700 "name": "insertOne",
701 "arguments": {
702 "document": {
703 "_id": 2,
704 "x": 22
705 }
706 }
707 }
708 ],
709 "options": {
710 "ordered": true
711 }
712 }
713 },
714 "outcome": {
715 "result": {
716 "deletedCount": 1,
717 "insertedCount": 1,
718 "insertedIds": {
719 "1": 2
720 },
721 "matchedCount": 0,
722 "modifiedCount": 0,
723 "upsertedCount": 0,
724 "upsertedIds": {}
725 },
726 "collection": {
727 "data": [
728 {
729 "_id": 2,
730 "x": 22
731 }
732 ]
733 }
734 }
735 },
736 {
737 "description": "Single-document write following updateMany is retried",
738 "failPoint": {
739 "configureFailPoint": "onPrimaryTransactionalWrite",
740 "mode": {
741 "times": 1
742 },
743 "data": {
744 "failBeforeCommitExceptionCode": 1
745 }
746 },
747 "operation": {
748 "name": "bulkWrite",
749 "arguments": {
750 "requests": [
751 {
752 "name": "updateMany",
753 "arguments": {
754 "filter": {
755 "x": 11
756 },
757 "update": {
758 "$inc": {
759 "x": 1
760 }
761 }
762 }
763 },
764 {
765 "name": "insertOne",
766 "arguments": {
767 "document": {
768 "_id": 2,
769 "x": 22
770 }
771 }
772 }
773 ],
774 "options": {
775 "ordered": true
776 }
777 }
778 },
779 "outcome": {
780 "result": {
781 "deletedCount": 0,
782 "insertedCount": 1,
783 "insertedIds": {
784 "1": 2
785 },
786 "matchedCount": 1,
787 "modifiedCount": 1,
788 "upsertedCount": 0,
789 "upsertedIds": {}
790 },
791 "collection": {
792 "data": [
793 {
794 "_id": 1,
795 "x": 12
796 },
797 {
798 "_id": 2,
799 "x": 22
800 }
801 ]
802 }
803 }
804 }
805 ]
806}
View as plain text