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": "transaction-tests",
17  "collection_name": "test",
18  "data": [],
19  "tests": [
20    {
21      "description": "DuplicateKey errors do not contain transient label",
22      "operations": [
23        {
24          "name": "startTransaction",
25          "object": "session0"
26        },
27        {
28          "name": "insertMany",
29          "object": "collection",
30          "arguments": {
31            "session": "session0",
32            "documents": [
33              {
34                "_id": 1
35              },
36              {
37                "_id": 1
38              }
39            ]
40          },
41          "result": {
42            "errorLabelsOmit": [
43              "TransientTransactionError",
44              "UnknownTransactionCommitResult"
45            ],
46            "errorContains": "E11000"
47          }
48        },
49        {
50          "name": "abortTransaction",
51          "object": "session0"
52        }
53      ],
54      "expectations": [
55        {
56          "command_started_event": {
57            "command": {
58              "insert": "test",
59              "documents": [
60                {
61                  "_id": 1
62                },
63                {
64                  "_id": 1
65                }
66              ],
67              "ordered": true,
68              "readConcern": null,
69              "lsid": "session0",
70              "txnNumber": {
71                "$numberLong": "1"
72              },
73              "startTransaction": true,
74              "autocommit": false,
75              "writeConcern": null
76            },
77            "command_name": "insert",
78            "database_name": "transaction-tests"
79          }
80        },
81        {
82          "command_started_event": {
83            "command": {
84              "abortTransaction": 1,
85              "lsid": "session0",
86              "txnNumber": {
87                "$numberLong": "1"
88              },
89              "startTransaction": null,
90              "autocommit": false,
91              "writeConcern": null
92            },
93            "command_name": "abortTransaction",
94            "database_name": "admin"
95          }
96        }
97      ],
98      "outcome": {
99        "collection": {
100          "data": []
101        }
102      }
103    },
104    {
105      "description": "NotMaster errors contain transient label",
106      "failPoint": {
107        "configureFailPoint": "failCommand",
108        "mode": {
109          "times": 1
110        },
111        "data": {
112          "failCommands": [
113            "insert"
114          ],
115          "errorCode": 10107
116        }
117      },
118      "operations": [
119        {
120          "name": "startTransaction",
121          "object": "session0"
122        },
123        {
124          "name": "insertOne",
125          "object": "collection",
126          "arguments": {
127            "session": "session0",
128            "document": {
129              "_id": 1
130            }
131          },
132          "result": {
133            "errorLabelsContain": [
134              "TransientTransactionError"
135            ],
136            "errorLabelsOmit": [
137              "RetryableWriteError",
138              "UnknownTransactionCommitResult"
139            ]
140          }
141        },
142        {
143          "name": "abortTransaction",
144          "object": "session0"
145        }
146      ],
147      "expectations": [
148        {
149          "command_started_event": {
150            "command": {
151              "insert": "test",
152              "documents": [
153                {
154                  "_id": 1
155                }
156              ],
157              "ordered": true,
158              "readConcern": null,
159              "lsid": "session0",
160              "txnNumber": {
161                "$numberLong": "1"
162              },
163              "startTransaction": true,
164              "autocommit": false,
165              "writeConcern": null
166            },
167            "command_name": "insert",
168            "database_name": "transaction-tests"
169          }
170        },
171        {
172          "command_started_event": {
173            "command": {
174              "abortTransaction": 1,
175              "lsid": "session0",
176              "txnNumber": {
177                "$numberLong": "1"
178              },
179              "startTransaction": null,
180              "autocommit": false,
181              "writeConcern": null
182            },
183            "command_name": "abortTransaction",
184            "database_name": "admin"
185          }
186        }
187      ],
188      "outcome": {
189        "collection": {
190          "data": []
191        }
192      }
193    },
194    {
195      "description": "WriteConflict errors contain transient label",
196      "failPoint": {
197        "configureFailPoint": "failCommand",
198        "mode": {
199          "times": 1
200        },
201        "data": {
202          "failCommands": [
203            "insert"
204          ],
205          "errorCode": 112
206        }
207      },
208      "operations": [
209        {
210          "name": "startTransaction",
211          "object": "session0"
212        },
213        {
214          "name": "insertOne",
215          "object": "collection",
216          "arguments": {
217            "session": "session0",
218            "document": {
219              "_id": 1
220            }
221          },
222          "result": {
223            "errorLabelsContain": [
224              "TransientTransactionError"
225            ],
226            "errorLabelsOmit": [
227              "RetryableWriteError",
228              "UnknownTransactionCommitResult"
229            ]
230          }
231        },
232        {
233          "name": "abortTransaction",
234          "object": "session0"
235        }
236      ],
237      "expectations": [
238        {
239          "command_started_event": {
240            "command": {
241              "insert": "test",
242              "documents": [
243                {
244                  "_id": 1
245                }
246              ],
247              "ordered": true,
248              "readConcern": null,
249              "lsid": "session0",
250              "txnNumber": {
251                "$numberLong": "1"
252              },
253              "startTransaction": true,
254              "autocommit": false,
255              "writeConcern": null
256            },
257            "command_name": "insert",
258            "database_name": "transaction-tests"
259          }
260        },
261        {
262          "command_started_event": {
263            "command": {
264              "abortTransaction": 1,
265              "lsid": "session0",
266              "txnNumber": {
267                "$numberLong": "1"
268              },
269              "startTransaction": null,
270              "autocommit": false,
271              "writeConcern": null
272            },
273            "command_name": "abortTransaction",
274            "database_name": "admin"
275          }
276        }
277      ],
278      "outcome": {
279        "collection": {
280          "data": []
281        }
282      }
283    },
284    {
285      "description": "NoSuchTransaction errors contain transient label",
286      "failPoint": {
287        "configureFailPoint": "failCommand",
288        "mode": {
289          "times": 1
290        },
291        "data": {
292          "failCommands": [
293            "insert"
294          ],
295          "errorCode": 251
296        }
297      },
298      "operations": [
299        {
300          "name": "startTransaction",
301          "object": "session0"
302        },
303        {
304          "name": "insertOne",
305          "object": "collection",
306          "arguments": {
307            "session": "session0",
308            "document": {
309              "_id": 1
310            }
311          },
312          "result": {
313            "errorLabelsContain": [
314              "TransientTransactionError"
315            ],
316            "errorLabelsOmit": [
317              "RetryableWriteError",
318              "UnknownTransactionCommitResult"
319            ]
320          }
321        },
322        {
323          "name": "abortTransaction",
324          "object": "session0"
325        }
326      ],
327      "expectations": [
328        {
329          "command_started_event": {
330            "command": {
331              "insert": "test",
332              "documents": [
333                {
334                  "_id": 1
335                }
336              ],
337              "ordered": true,
338              "readConcern": null,
339              "lsid": "session0",
340              "txnNumber": {
341                "$numberLong": "1"
342              },
343              "startTransaction": true,
344              "autocommit": false,
345              "writeConcern": null
346            },
347            "command_name": "insert",
348            "database_name": "transaction-tests"
349          }
350        },
351        {
352          "command_started_event": {
353            "command": {
354              "abortTransaction": 1,
355              "lsid": "session0",
356              "txnNumber": {
357                "$numberLong": "1"
358              },
359              "startTransaction": null,
360              "autocommit": false,
361              "writeConcern": null
362            },
363            "command_name": "abortTransaction",
364            "database_name": "admin"
365          }
366        }
367      ],
368      "outcome": {
369        "collection": {
370          "data": []
371        }
372      }
373    },
374    {
375      "description": "NoSuchTransaction errors on commit contain transient label",
376      "failPoint": {
377        "configureFailPoint": "failCommand",
378        "mode": {
379          "times": 1
380        },
381        "data": {
382          "failCommands": [
383            "commitTransaction"
384          ],
385          "errorCode": 251
386        }
387      },
388      "operations": [
389        {
390          "name": "startTransaction",
391          "object": "session0"
392        },
393        {
394          "name": "insertOne",
395          "object": "collection",
396          "arguments": {
397            "session": "session0",
398            "document": {
399              "_id": 1
400            }
401          },
402          "result": {
403            "insertedId": 1
404          }
405        },
406        {
407          "name": "commitTransaction",
408          "object": "session0",
409          "result": {
410            "errorLabelsContain": [
411              "TransientTransactionError"
412            ],
413            "errorLabelsOmit": [
414              "RetryableWriteError",
415              "UnknownTransactionCommitResult"
416            ]
417          }
418        }
419      ],
420      "expectations": [
421        {
422          "command_started_event": {
423            "command": {
424              "insert": "test",
425              "documents": [
426                {
427                  "_id": 1
428                }
429              ],
430              "ordered": true,
431              "readConcern": null,
432              "lsid": "session0",
433              "txnNumber": {
434                "$numberLong": "1"
435              },
436              "startTransaction": true,
437              "autocommit": false,
438              "writeConcern": null
439            },
440            "command_name": "insert",
441            "database_name": "transaction-tests"
442          }
443        },
444        {
445          "command_started_event": {
446            "command": {
447              "commitTransaction": 1,
448              "lsid": "session0",
449              "txnNumber": {
450                "$numberLong": "1"
451              },
452              "startTransaction": null,
453              "autocommit": false,
454              "writeConcern": null
455            },
456            "command_name": "commitTransaction",
457            "database_name": "admin"
458          }
459        }
460      ],
461      "outcome": {
462        "collection": {
463          "data": []
464        }
465      }
466    },
467    {
468      "description": "add TransientTransactionError label to connection errors, but do not add RetryableWriteError label",
469      "failPoint": {
470        "configureFailPoint": "failCommand",
471        "mode": {
472          "times": 4
473        },
474        "data": {
475          "failCommands": [
476            "insert",
477            "find",
478            "aggregate",
479            "distinct"
480          ],
481          "closeConnection": true
482        }
483      },
484      "operations": [
485        {
486          "name": "startTransaction",
487          "object": "session0"
488        },
489        {
490          "name": "insertOne",
491          "object": "collection",
492          "arguments": {
493            "session": "session0",
494            "document": {
495              "_id": 1
496            }
497          },
498          "result": {
499            "errorLabelsContain": [
500              "TransientTransactionError"
501            ],
502            "errorLabelsOmit": [
503              "RetryableWriteError",
504              "UnknownTransactionCommitResult"
505            ]
506          }
507        },
508        {
509          "name": "find",
510          "object": "collection",
511          "arguments": {
512            "session": "session0"
513          },
514          "result": {
515            "errorLabelsContain": [
516              "TransientTransactionError"
517            ],
518            "errorLabelsOmit": [
519              "RetryableWriteError",
520              "UnknownTransactionCommitResult"
521            ]
522          }
523        },
524        {
525          "name": "aggregate",
526          "object": "collection",
527          "arguments": {
528            "pipeline": [
529              {
530                "$project": {
531                  "_id": 1
532                }
533              }
534            ],
535            "session": "session0"
536          },
537          "result": {
538            "errorLabelsContain": [
539              "TransientTransactionError"
540            ],
541            "errorLabelsOmit": [
542              "RetryableWriteError",
543              "UnknownTransactionCommitResult"
544            ]
545          }
546        },
547        {
548          "name": "distinct",
549          "object": "collection",
550          "arguments": {
551            "fieldName": "_id",
552            "session": "session0"
553          },
554          "result": {
555            "errorLabelsContain": [
556              "TransientTransactionError"
557            ],
558            "errorLabelsOmit": [
559              "RetryableWriteError",
560              "UnknownTransactionCommitResult"
561            ]
562          }
563        },
564        {
565          "name": "abortTransaction",
566          "object": "session0"
567        }
568      ],
569      "expectations": [
570        {
571          "command_started_event": {
572            "command": {
573              "insert": "test",
574              "documents": [
575                {
576                  "_id": 1
577                }
578              ],
579              "ordered": true,
580              "readConcern": null,
581              "lsid": "session0",
582              "txnNumber": {
583                "$numberLong": "1"
584              },
585              "startTransaction": true,
586              "autocommit": false,
587              "writeConcern": null
588            },
589            "command_name": "insert",
590            "database_name": "transaction-tests"
591          }
592        },
593        {
594          "command_started_event": {
595            "command": {
596              "find": "test",
597              "readConcern": null,
598              "lsid": "session0",
599              "txnNumber": {
600                "$numberLong": "1"
601              },
602              "startTransaction": null,
603              "autocommit": false
604            },
605            "command_name": "find",
606            "database_name": "transaction-tests"
607          }
608        },
609        {
610          "command_started_event": {
611            "command": {
612              "aggregate": "test",
613              "pipeline": [
614                {
615                  "$project": {
616                    "_id": 1
617                  }
618                }
619              ],
620              "cursor": {},
621              "readConcern": null,
622              "lsid": "session0",
623              "txnNumber": {
624                "$numberLong": "1"
625              },
626              "startTransaction": null,
627              "autocommit": false
628            },
629            "command_name": "aggregate",
630            "database_name": "transaction-tests"
631          }
632        },
633        {
634          "command_started_event": {
635            "command": {
636              "distinct": "test",
637              "key": "_id",
638              "lsid": "session0",
639              "readConcern": null,
640              "txnNumber": {
641                "$numberLong": "1"
642              },
643              "startTransaction": null,
644              "autocommit": false
645            },
646            "command_name": "distinct",
647            "database_name": "transaction-tests"
648          }
649        },
650        {
651          "command_started_event": {
652            "command": {
653              "abortTransaction": 1,
654              "lsid": "session0",
655              "txnNumber": {
656                "$numberLong": "1"
657              },
658              "startTransaction": null,
659              "autocommit": false,
660              "writeConcern": null
661            },
662            "command_name": "abortTransaction",
663            "database_name": "admin"
664          }
665        }
666      ],
667      "outcome": {
668        "collection": {
669          "data": []
670        }
671      }
672    },
673    {
674      "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors",
675      "failPoint": {
676        "configureFailPoint": "failCommand",
677        "mode": {
678          "times": 2
679        },
680        "data": {
681          "failCommands": [
682            "commitTransaction"
683          ],
684          "closeConnection": true
685        }
686      },
687      "operations": [
688        {
689          "name": "startTransaction",
690          "object": "session0"
691        },
692        {
693          "name": "insertOne",
694          "object": "collection",
695          "arguments": {
696            "session": "session0",
697            "document": {
698              "_id": 1
699            }
700          },
701          "result": {
702            "insertedId": 1
703          }
704        },
705        {
706          "name": "commitTransaction",
707          "object": "session0",
708          "result": {
709            "errorLabelsContain": [
710              "RetryableWriteError",
711              "UnknownTransactionCommitResult"
712            ],
713            "errorLabelsOmit": [
714              "TransientTransactionError"
715            ]
716          }
717        },
718        {
719          "name": "commitTransaction",
720          "object": "session0"
721        }
722      ],
723      "expectations": [
724        {
725          "command_started_event": {
726            "command": {
727              "insert": "test",
728              "documents": [
729                {
730                  "_id": 1
731                }
732              ],
733              "ordered": true,
734              "readConcern": null,
735              "lsid": "session0",
736              "txnNumber": {
737                "$numberLong": "1"
738              },
739              "startTransaction": true,
740              "autocommit": false,
741              "writeConcern": null
742            },
743            "command_name": "insert",
744            "database_name": "transaction-tests"
745          }
746        },
747        {
748          "command_started_event": {
749            "command": {
750              "commitTransaction": 1,
751              "lsid": "session0",
752              "txnNumber": {
753                "$numberLong": "1"
754              },
755              "startTransaction": null,
756              "autocommit": false,
757              "writeConcern": null
758            },
759            "command_name": "commitTransaction",
760            "database_name": "admin"
761          }
762        },
763        {
764          "command_started_event": {
765            "command": {
766              "commitTransaction": 1,
767              "lsid": "session0",
768              "txnNumber": {
769                "$numberLong": "1"
770              },
771              "startTransaction": null,
772              "autocommit": false,
773              "writeConcern": {
774                "w": "majority",
775                "wtimeout": 10000
776              }
777            },
778            "command_name": "commitTransaction",
779            "database_name": "admin"
780          }
781        },
782        {
783          "command_started_event": {
784            "command": {
785              "commitTransaction": 1,
786              "lsid": "session0",
787              "txnNumber": {
788                "$numberLong": "1"
789              },
790              "startTransaction": null,
791              "autocommit": false,
792              "writeConcern": {
793                "w": "majority",
794                "wtimeout": 10000
795              }
796            },
797            "command_name": "commitTransaction",
798            "database_name": "admin"
799          }
800        }
801      ],
802      "outcome": {
803        "collection": {
804          "data": [
805            {
806              "_id": 1
807            }
808          ]
809        }
810      }
811    },
812    {
813      "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to retryable commit errors",
814      "failPoint": {
815        "configureFailPoint": "failCommand",
816        "mode": {
817          "times": 2
818        },
819        "data": {
820          "failCommands": [
821            "commitTransaction"
822          ],
823          "errorCode": 11602,
824          "errorLabels": [
825            "RetryableWriteError"
826          ]
827        }
828      },
829      "operations": [
830        {
831          "name": "startTransaction",
832          "object": "session0"
833        },
834        {
835          "name": "insertOne",
836          "object": "collection",
837          "arguments": {
838            "session": "session0",
839            "document": {
840              "_id": 1
841            }
842          },
843          "result": {
844            "insertedId": 1
845          }
846        },
847        {
848          "name": "commitTransaction",
849          "object": "session0",
850          "result": {
851            "errorLabelsContain": [
852              "RetryableWriteError",
853              "UnknownTransactionCommitResult"
854            ],
855            "errorLabelsOmit": [
856              "TransientTransactionError"
857            ]
858          }
859        },
860        {
861          "name": "commitTransaction",
862          "object": "session0"
863        }
864      ],
865      "expectations": [
866        {
867          "command_started_event": {
868            "command": {
869              "insert": "test",
870              "documents": [
871                {
872                  "_id": 1
873                }
874              ],
875              "ordered": true,
876              "readConcern": null,
877              "lsid": "session0",
878              "txnNumber": {
879                "$numberLong": "1"
880              },
881              "startTransaction": true,
882              "autocommit": false,
883              "writeConcern": null
884            },
885            "command_name": "insert",
886            "database_name": "transaction-tests"
887          }
888        },
889        {
890          "command_started_event": {
891            "command": {
892              "commitTransaction": 1,
893              "lsid": "session0",
894              "txnNumber": {
895                "$numberLong": "1"
896              },
897              "startTransaction": null,
898              "autocommit": false,
899              "writeConcern": null
900            },
901            "command_name": "commitTransaction",
902            "database_name": "admin"
903          }
904        },
905        {
906          "command_started_event": {
907            "command": {
908              "commitTransaction": 1,
909              "lsid": "session0",
910              "txnNumber": {
911                "$numberLong": "1"
912              },
913              "startTransaction": null,
914              "autocommit": false,
915              "writeConcern": {
916                "w": "majority",
917                "wtimeout": 10000
918              }
919            },
920            "command_name": "commitTransaction",
921            "database_name": "admin"
922          }
923        },
924        {
925          "command_started_event": {
926            "command": {
927              "commitTransaction": 1,
928              "lsid": "session0",
929              "txnNumber": {
930                "$numberLong": "1"
931              },
932              "startTransaction": null,
933              "autocommit": false,
934              "writeConcern": {
935                "w": "majority",
936                "wtimeout": 10000
937              }
938            },
939            "command_name": "commitTransaction",
940            "database_name": "admin"
941          }
942        }
943      ],
944      "outcome": {
945        "collection": {
946          "data": [
947            {
948              "_id": 1
949            }
950          ]
951        }
952      }
953    },
954    {
955      "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to writeConcernError ShutdownInProgress",
956      "failPoint": {
957        "configureFailPoint": "failCommand",
958        "mode": {
959          "times": 2
960        },
961        "data": {
962          "failCommands": [
963            "commitTransaction"
964          ],
965          "writeConcernError": {
966            "code": 91,
967            "errmsg": "Replication is being shut down",
968            "errorLabels": [
969              "RetryableWriteError"
970            ]
971          }
972        }
973      },
974      "operations": [
975        {
976          "name": "startTransaction",
977          "object": "session0",
978          "arguments": {
979            "options": {
980              "writeConcern": {
981                "w": "majority"
982              }
983            }
984          }
985        },
986        {
987          "name": "insertOne",
988          "object": "collection",
989          "arguments": {
990            "session": "session0",
991            "document": {
992              "_id": 1
993            }
994          },
995          "result": {
996            "insertedId": 1
997          }
998        },
999        {
1000          "name": "commitTransaction",
1001          "object": "session0",
1002          "result": {
1003            "errorLabelsContain": [
1004              "RetryableWriteError",
1005              "UnknownTransactionCommitResult"
1006            ],
1007            "errorLabelsOmit": [
1008              "TransientTransactionError"
1009            ]
1010          }
1011        },
1012        {
1013          "name": "commitTransaction",
1014          "object": "session0"
1015        }
1016      ],
1017      "expectations": [
1018        {
1019          "command_started_event": {
1020            "command": {
1021              "insert": "test",
1022              "documents": [
1023                {
1024                  "_id": 1
1025                }
1026              ],
1027              "ordered": true,
1028              "readConcern": null,
1029              "lsid": "session0",
1030              "txnNumber": {
1031                "$numberLong": "1"
1032              },
1033              "startTransaction": true,
1034              "autocommit": false,
1035              "writeConcern": null
1036            },
1037            "command_name": "insert",
1038            "database_name": "transaction-tests"
1039          }
1040        },
1041        {
1042          "command_started_event": {
1043            "command": {
1044              "commitTransaction": 1,
1045              "lsid": "session0",
1046              "txnNumber": {
1047                "$numberLong": "1"
1048              },
1049              "startTransaction": null,
1050              "autocommit": false,
1051              "writeConcern": {
1052                "w": "majority"
1053              }
1054            },
1055            "command_name": "commitTransaction",
1056            "database_name": "admin"
1057          }
1058        },
1059        {
1060          "command_started_event": {
1061            "command": {
1062              "commitTransaction": 1,
1063              "lsid": "session0",
1064              "txnNumber": {
1065                "$numberLong": "1"
1066              },
1067              "startTransaction": null,
1068              "autocommit": false,
1069              "writeConcern": {
1070                "w": "majority",
1071                "wtimeout": 10000
1072              }
1073            },
1074            "command_name": "commitTransaction",
1075            "database_name": "admin"
1076          }
1077        },
1078        {
1079          "command_started_event": {
1080            "command": {
1081              "commitTransaction": 1,
1082              "lsid": "session0",
1083              "txnNumber": {
1084                "$numberLong": "1"
1085              },
1086              "startTransaction": null,
1087              "autocommit": false,
1088              "writeConcern": {
1089                "w": "majority",
1090                "wtimeout": 10000
1091              }
1092            },
1093            "command_name": "commitTransaction",
1094            "database_name": "admin"
1095          }
1096        }
1097      ],
1098      "outcome": {
1099        "collection": {
1100          "data": [
1101            {
1102              "_id": 1
1103            }
1104          ]
1105        }
1106      }
1107    },
1108    {
1109      "description": "do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction",
1110      "failPoint": {
1111        "configureFailPoint": "failCommand",
1112        "mode": {
1113          "times": 1
1114        },
1115        "data": {
1116          "failCommands": [
1117            "insert"
1118          ],
1119          "writeConcernError": {
1120            "code": 91,
1121            "errmsg": "Replication is being shut down"
1122          }
1123        }
1124      },
1125      "operations": [
1126        {
1127          "name": "startTransaction",
1128          "object": "session0",
1129          "arguments": {
1130            "options": {
1131              "writeConcern": {
1132                "w": "majority"
1133              }
1134            }
1135          }
1136        },
1137        {
1138          "name": "insertOne",
1139          "object": "collection",
1140          "arguments": {
1141            "session": "session0",
1142            "document": {
1143              "_id": 1
1144            }
1145          },
1146          "result": {
1147            "errorLabelsContain": [],
1148            "errorLabelsOmit": [
1149              "RetryableWriteError",
1150              "TransientTransactionError",
1151              "UnknownTransactionCommitResult"
1152            ]
1153          }
1154        },
1155        {
1156          "name": "abortTransaction",
1157          "object": "session0"
1158        }
1159      ],
1160      "expectations": [
1161        {
1162          "command_started_event": {
1163            "command": {
1164              "insert": "test",
1165              "documents": [
1166                {
1167                  "_id": 1
1168                }
1169              ],
1170              "ordered": true,
1171              "readConcern": null,
1172              "lsid": "session0",
1173              "txnNumber": {
1174                "$numberLong": "1"
1175              },
1176              "startTransaction": true,
1177              "autocommit": false
1178            },
1179            "command_name": "insert",
1180            "database_name": "transaction-tests"
1181          }
1182        },
1183        {
1184          "command_started_event": {
1185            "command": {
1186              "abortTransaction": 1,
1187              "lsid": "session0",
1188              "txnNumber": {
1189                "$numberLong": "1"
1190              },
1191              "startTransaction": null,
1192              "autocommit": false
1193            },
1194            "command_name": "abortTransaction",
1195            "database_name": "admin"
1196          }
1197        }
1198      ],
1199      "outcome": {
1200        "collection": {
1201          "data": []
1202        }
1203      }
1204    },
1205    {
1206      "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed",
1207      "failPoint": {
1208        "configureFailPoint": "failCommand",
1209        "mode": {
1210          "times": 1
1211        },
1212        "data": {
1213          "failCommands": [
1214            "commitTransaction"
1215          ],
1216          "writeConcernError": {
1217            "code": 64,
1218            "errmsg": "multiple errors reported"
1219          }
1220        }
1221      },
1222      "operations": [
1223        {
1224          "name": "startTransaction",
1225          "object": "session0",
1226          "arguments": {
1227            "options": {
1228              "writeConcern": {
1229                "w": "majority"
1230              }
1231            }
1232          }
1233        },
1234        {
1235          "name": "insertOne",
1236          "object": "collection",
1237          "arguments": {
1238            "session": "session0",
1239            "document": {
1240              "_id": 1
1241            }
1242          },
1243          "result": {
1244            "insertedId": 1
1245          }
1246        },
1247        {
1248          "name": "commitTransaction",
1249          "object": "session0",
1250          "result": {
1251            "errorLabelsContain": [
1252              "UnknownTransactionCommitResult"
1253            ],
1254            "errorLabelsOmit": [
1255              "RetryableWriteError",
1256              "TransientTransactionError"
1257            ]
1258          }
1259        },
1260        {
1261          "name": "commitTransaction",
1262          "object": "session0"
1263        }
1264      ],
1265      "expectations": [
1266        {
1267          "command_started_event": {
1268            "command": {
1269              "insert": "test",
1270              "documents": [
1271                {
1272                  "_id": 1
1273                }
1274              ],
1275              "ordered": true,
1276              "readConcern": null,
1277              "lsid": "session0",
1278              "txnNumber": {
1279                "$numberLong": "1"
1280              },
1281              "startTransaction": true,
1282              "autocommit": false,
1283              "writeConcern": null
1284            },
1285            "command_name": "insert",
1286            "database_name": "transaction-tests"
1287          }
1288        },
1289        {
1290          "command_started_event": {
1291            "command": {
1292              "commitTransaction": 1,
1293              "lsid": "session0",
1294              "txnNumber": {
1295                "$numberLong": "1"
1296              },
1297              "startTransaction": null,
1298              "autocommit": false,
1299              "writeConcern": {
1300                "w": "majority"
1301              }
1302            },
1303            "command_name": "commitTransaction",
1304            "database_name": "admin"
1305          }
1306        },
1307        {
1308          "command_started_event": {
1309            "command": {
1310              "commitTransaction": 1,
1311              "lsid": "session0",
1312              "txnNumber": {
1313                "$numberLong": "1"
1314              },
1315              "startTransaction": null,
1316              "autocommit": false,
1317              "writeConcern": {
1318                "w": "majority",
1319                "wtimeout": 10000
1320              }
1321            },
1322            "command_name": "commitTransaction",
1323            "database_name": "admin"
1324          }
1325        }
1326      ],
1327      "outcome": {
1328        "collection": {
1329          "data": [
1330            {
1331              "_id": 1
1332            }
1333          ]
1334        }
1335      }
1336    },
1337    {
1338      "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout",
1339      "failPoint": {
1340        "configureFailPoint": "failCommand",
1341        "mode": {
1342          "times": 1
1343        },
1344        "data": {
1345          "failCommands": [
1346            "commitTransaction"
1347          ],
1348          "writeConcernError": {
1349            "code": 64,
1350            "codeName": "WriteConcernFailed",
1351            "errmsg": "waiting for replication timed out",
1352            "errInfo": {
1353              "wtimeout": true
1354            }
1355          }
1356        }
1357      },
1358      "operations": [
1359        {
1360          "name": "startTransaction",
1361          "object": "session0",
1362          "arguments": {
1363            "options": {
1364              "writeConcern": {
1365                "w": "majority"
1366              }
1367            }
1368          }
1369        },
1370        {
1371          "name": "insertOne",
1372          "object": "collection",
1373          "arguments": {
1374            "session": "session0",
1375            "document": {
1376              "_id": 1
1377            }
1378          },
1379          "result": {
1380            "insertedId": 1
1381          }
1382        },
1383        {
1384          "name": "commitTransaction",
1385          "object": "session0",
1386          "result": {
1387            "errorLabelsContain": [
1388              "UnknownTransactionCommitResult"
1389            ],
1390            "errorLabelsOmit": [
1391              "RetryableWriteError",
1392              "TransientTransactionError"
1393            ]
1394          }
1395        },
1396        {
1397          "name": "commitTransaction",
1398          "object": "session0"
1399        }
1400      ],
1401      "expectations": [
1402        {
1403          "command_started_event": {
1404            "command": {
1405              "insert": "test",
1406              "documents": [
1407                {
1408                  "_id": 1
1409                }
1410              ],
1411              "ordered": true,
1412              "readConcern": null,
1413              "lsid": "session0",
1414              "txnNumber": {
1415                "$numberLong": "1"
1416              },
1417              "startTransaction": true,
1418              "autocommit": false,
1419              "writeConcern": null
1420            },
1421            "command_name": "insert",
1422            "database_name": "transaction-tests"
1423          }
1424        },
1425        {
1426          "command_started_event": {
1427            "command": {
1428              "commitTransaction": 1,
1429              "lsid": "session0",
1430              "txnNumber": {
1431                "$numberLong": "1"
1432              },
1433              "startTransaction": null,
1434              "autocommit": false,
1435              "writeConcern": {
1436                "w": "majority"
1437              }
1438            },
1439            "command_name": "commitTransaction",
1440            "database_name": "admin"
1441          }
1442        },
1443        {
1444          "command_started_event": {
1445            "command": {
1446              "commitTransaction": 1,
1447              "lsid": "session0",
1448              "txnNumber": {
1449                "$numberLong": "1"
1450              },
1451              "startTransaction": null,
1452              "autocommit": false,
1453              "writeConcern": {
1454                "w": "majority",
1455                "wtimeout": 10000
1456              }
1457            },
1458            "command_name": "commitTransaction",
1459            "database_name": "admin"
1460          }
1461        }
1462      ],
1463      "outcome": {
1464        "collection": {
1465          "data": [
1466            {
1467              "_id": 1
1468            }
1469          ]
1470        }
1471      }
1472    },
1473    {
1474      "description": "omit UnknownTransactionCommitResult label from writeConcernError UnsatisfiableWriteConcern",
1475      "failPoint": {
1476        "configureFailPoint": "failCommand",
1477        "mode": {
1478          "times": 1
1479        },
1480        "data": {
1481          "failCommands": [
1482            "commitTransaction"
1483          ],
1484          "writeConcernError": {
1485            "code": 100,
1486            "errmsg": "Not enough data-bearing nodes"
1487          }
1488        }
1489      },
1490      "operations": [
1491        {
1492          "name": "startTransaction",
1493          "object": "session0",
1494          "arguments": {
1495            "options": {
1496              "writeConcern": {
1497                "w": "majority"
1498              }
1499            }
1500          }
1501        },
1502        {
1503          "name": "insertOne",
1504          "object": "collection",
1505          "arguments": {
1506            "session": "session0",
1507            "document": {
1508              "_id": 1
1509            }
1510          },
1511          "result": {
1512            "insertedId": 1
1513          }
1514        },
1515        {
1516          "name": "commitTransaction",
1517          "object": "session0",
1518          "result": {
1519            "errorLabelsOmit": [
1520              "RetryableWriteError",
1521              "TransientTransactionError",
1522              "UnknownTransactionCommitResult"
1523            ]
1524          }
1525        }
1526      ],
1527      "expectations": [
1528        {
1529          "command_started_event": {
1530            "command": {
1531              "insert": "test",
1532              "documents": [
1533                {
1534                  "_id": 1
1535                }
1536              ],
1537              "ordered": true,
1538              "readConcern": null,
1539              "lsid": "session0",
1540              "txnNumber": {
1541                "$numberLong": "1"
1542              },
1543              "startTransaction": true,
1544              "autocommit": false,
1545              "writeConcern": null
1546            },
1547            "command_name": "insert",
1548            "database_name": "transaction-tests"
1549          }
1550        },
1551        {
1552          "command_started_event": {
1553            "command": {
1554              "commitTransaction": 1,
1555              "lsid": "session0",
1556              "txnNumber": {
1557                "$numberLong": "1"
1558              },
1559              "startTransaction": null,
1560              "autocommit": false,
1561              "writeConcern": {
1562                "w": "majority"
1563              }
1564            },
1565            "command_name": "commitTransaction",
1566            "database_name": "admin"
1567          }
1568        }
1569      ],
1570      "outcome": {
1571        "collection": {
1572          "data": [
1573            {
1574              "_id": 1
1575            }
1576          ]
1577        }
1578      }
1579    },
1580    {
1581      "description": "omit UnknownTransactionCommitResult label from writeConcernError UnknownReplWriteConcern",
1582      "failPoint": {
1583        "configureFailPoint": "failCommand",
1584        "mode": {
1585          "times": 1
1586        },
1587        "data": {
1588          "failCommands": [
1589            "commitTransaction"
1590          ],
1591          "writeConcernError": {
1592            "code": 79,
1593            "errmsg": "No write concern mode named 'blah' found in replica set configuration"
1594          }
1595        }
1596      },
1597      "operations": [
1598        {
1599          "name": "startTransaction",
1600          "object": "session0",
1601          "arguments": {
1602            "options": {
1603              "writeConcern": {
1604                "w": "majority"
1605              }
1606            }
1607          }
1608        },
1609        {
1610          "name": "insertOne",
1611          "object": "collection",
1612          "arguments": {
1613            "session": "session0",
1614            "document": {
1615              "_id": 1
1616            }
1617          },
1618          "result": {
1619            "insertedId": 1
1620          }
1621        },
1622        {
1623          "name": "commitTransaction",
1624          "object": "session0",
1625          "result": {
1626            "errorLabelsOmit": [
1627              "RetryableWriteConcern",
1628              "TransientTransactionError",
1629              "UnknownTransactionCommitResult"
1630            ]
1631          }
1632        }
1633      ],
1634      "expectations": [
1635        {
1636          "command_started_event": {
1637            "command": {
1638              "insert": "test",
1639              "documents": [
1640                {
1641                  "_id": 1
1642                }
1643              ],
1644              "ordered": true,
1645              "readConcern": null,
1646              "lsid": "session0",
1647              "txnNumber": {
1648                "$numberLong": "1"
1649              },
1650              "startTransaction": true,
1651              "autocommit": false,
1652              "writeConcern": null
1653            },
1654            "command_name": "insert",
1655            "database_name": "transaction-tests"
1656          }
1657        },
1658        {
1659          "command_started_event": {
1660            "command": {
1661              "commitTransaction": 1,
1662              "lsid": "session0",
1663              "txnNumber": {
1664                "$numberLong": "1"
1665              },
1666              "startTransaction": null,
1667              "autocommit": false,
1668              "writeConcern": {
1669                "w": "majority"
1670              }
1671            },
1672            "command_name": "commitTransaction",
1673            "database_name": "admin"
1674          }
1675        }
1676      ],
1677      "outcome": {
1678        "collection": {
1679          "data": [
1680            {
1681              "_id": 1
1682            }
1683          ]
1684        }
1685      }
1686    },
1687    {
1688      "description": "do not add UnknownTransactionCommitResult label to MaxTimeMSExpired inside transactions",
1689      "failPoint": {
1690        "configureFailPoint": "failCommand",
1691        "mode": {
1692          "times": 1
1693        },
1694        "data": {
1695          "failCommands": [
1696            "aggregate"
1697          ],
1698          "errorCode": 50
1699        }
1700      },
1701      "operations": [
1702        {
1703          "name": "startTransaction",
1704          "object": "session0"
1705        },
1706        {
1707          "name": "insertOne",
1708          "object": "collection",
1709          "arguments": {
1710            "session": "session0",
1711            "document": {
1712              "_id": 1
1713            }
1714          },
1715          "result": {
1716            "insertedId": 1
1717          }
1718        },
1719        {
1720          "name": "aggregate",
1721          "object": "collection",
1722          "arguments": {
1723            "pipeline": [
1724              {
1725                "$project": {
1726                  "_id": 1
1727                }
1728              }
1729            ],
1730            "maxTimeMS": 60000,
1731            "session": "session0"
1732          },
1733          "result": {
1734            "errorLabelsOmit": [
1735              "RetryableWriteError",
1736              "UnknownTransactionCommitResult",
1737              "TransientTransactionError"
1738            ]
1739          }
1740        },
1741        {
1742          "name": "abortTransaction",
1743          "object": "session0"
1744        }
1745      ],
1746      "expectations": [
1747        {
1748          "command_started_event": {
1749            "command": {
1750              "insert": "test",
1751              "documents": [
1752                {
1753                  "_id": 1
1754                }
1755              ],
1756              "ordered": true,
1757              "readConcern": null,
1758              "lsid": "session0",
1759              "txnNumber": {
1760                "$numberLong": "1"
1761              },
1762              "startTransaction": true,
1763              "autocommit": false,
1764              "writeConcern": null
1765            },
1766            "command_name": "insert",
1767            "database_name": "transaction-tests"
1768          }
1769        },
1770        {
1771          "command_started_event": {
1772            "command": {
1773              "aggregate": "test",
1774              "pipeline": [
1775                {
1776                  "$project": {
1777                    "_id": 1
1778                  }
1779                }
1780              ],
1781              "cursor": {},
1782              "readConcern": null,
1783              "lsid": "session0",
1784              "txnNumber": {
1785                "$numberLong": "1"
1786              },
1787              "autocommit": false,
1788              "maxTimeMS": 60000
1789            },
1790            "command_name": "aggregate",
1791            "database_name": "transaction-tests"
1792          }
1793        },
1794        {
1795          "command_started_event": {
1796            "command": {
1797              "abortTransaction": 1,
1798              "lsid": "session0",
1799              "txnNumber": {
1800                "$numberLong": "1"
1801              },
1802              "startTransaction": null,
1803              "autocommit": false,
1804              "writeConcern": null
1805            },
1806            "command_name": "abortTransaction",
1807            "database_name": "admin"
1808          }
1809        }
1810      ],
1811      "outcome": {
1812        "collection": {
1813          "data": []
1814        }
1815      }
1816    },
1817    {
1818      "description": "add UnknownTransactionCommitResult label to MaxTimeMSExpired",
1819      "failPoint": {
1820        "configureFailPoint": "failCommand",
1821        "mode": {
1822          "times": 1
1823        },
1824        "data": {
1825          "failCommands": [
1826            "commitTransaction"
1827          ],
1828          "errorCode": 50
1829        }
1830      },
1831      "operations": [
1832        {
1833          "name": "startTransaction",
1834          "object": "session0",
1835          "arguments": {
1836            "options": {
1837              "writeConcern": {
1838                "w": "majority"
1839              },
1840              "maxCommitTimeMS": 60000
1841            }
1842          }
1843        },
1844        {
1845          "name": "insertOne",
1846          "object": "collection",
1847          "arguments": {
1848            "session": "session0",
1849            "document": {
1850              "_id": 1
1851            }
1852          },
1853          "result": {
1854            "insertedId": 1
1855          }
1856        },
1857        {
1858          "name": "commitTransaction",
1859          "object": "session0",
1860          "result": {
1861            "errorLabelsContain": [
1862              "UnknownTransactionCommitResult"
1863            ],
1864            "errorLabelsOmit": [
1865              "RetryableWriteError",
1866              "TransientTransactionError"
1867            ]
1868          }
1869        },
1870        {
1871          "name": "commitTransaction",
1872          "object": "session0"
1873        }
1874      ],
1875      "expectations": [
1876        {
1877          "command_started_event": {
1878            "command": {
1879              "insert": "test",
1880              "documents": [
1881                {
1882                  "_id": 1
1883                }
1884              ],
1885              "ordered": true,
1886              "readConcern": null,
1887              "lsid": "session0",
1888              "txnNumber": {
1889                "$numberLong": "1"
1890              },
1891              "startTransaction": true,
1892              "autocommit": false,
1893              "writeConcern": null
1894            },
1895            "command_name": "insert",
1896            "database_name": "transaction-tests"
1897          }
1898        },
1899        {
1900          "command_started_event": {
1901            "command": {
1902              "commitTransaction": 1,
1903              "lsid": "session0",
1904              "txnNumber": {
1905                "$numberLong": "1"
1906              },
1907              "startTransaction": null,
1908              "autocommit": false,
1909              "writeConcern": {
1910                "w": "majority"
1911              },
1912              "maxTimeMS": 60000
1913            },
1914            "command_name": "commitTransaction",
1915            "database_name": "admin"
1916          }
1917        },
1918        {
1919          "command_started_event": {
1920            "command": {
1921              "commitTransaction": 1,
1922              "lsid": "session0",
1923              "txnNumber": {
1924                "$numberLong": "1"
1925              },
1926              "startTransaction": null,
1927              "autocommit": false,
1928              "writeConcern": {
1929                "w": "majority",
1930                "wtimeout": 10000
1931              },
1932              "maxTimeMS": 60000
1933            },
1934            "command_name": "commitTransaction",
1935            "database_name": "admin"
1936          }
1937        }
1938      ],
1939      "outcome": {
1940        "collection": {
1941          "data": [
1942            {
1943              "_id": 1
1944            }
1945          ]
1946        }
1947      }
1948    },
1949    {
1950      "description": "add UnknownTransactionCommitResult label to writeConcernError MaxTimeMSExpired",
1951      "failPoint": {
1952        "configureFailPoint": "failCommand",
1953        "mode": {
1954          "times": 1
1955        },
1956        "data": {
1957          "failCommands": [
1958            "commitTransaction"
1959          ],
1960          "writeConcernError": {
1961            "code": 50,
1962            "errmsg": "operation exceeded time limit"
1963          }
1964        }
1965      },
1966      "operations": [
1967        {
1968          "name": "startTransaction",
1969          "object": "session0",
1970          "arguments": {
1971            "options": {
1972              "writeConcern": {
1973                "w": "majority"
1974              },
1975              "maxCommitTimeMS": 60000
1976            }
1977          }
1978        },
1979        {
1980          "name": "insertOne",
1981          "object": "collection",
1982          "arguments": {
1983            "session": "session0",
1984            "document": {
1985              "_id": 1
1986            }
1987          },
1988          "result": {
1989            "insertedId": 1
1990          }
1991        },
1992        {
1993          "name": "commitTransaction",
1994          "object": "session0",
1995          "result": {
1996            "errorLabelsContain": [
1997              "UnknownTransactionCommitResult"
1998            ],
1999            "errorLabelsOmit": [
2000              "RetryableWriteError",
2001              "TransientTransactionError"
2002            ]
2003          }
2004        },
2005        {
2006          "name": "commitTransaction",
2007          "object": "session0"
2008        }
2009      ],
2010      "expectations": [
2011        {
2012          "command_started_event": {
2013            "command": {
2014              "insert": "test",
2015              "documents": [
2016                {
2017                  "_id": 1
2018                }
2019              ],
2020              "ordered": true,
2021              "readConcern": null,
2022              "lsid": "session0",
2023              "txnNumber": {
2024                "$numberLong": "1"
2025              },
2026              "startTransaction": true,
2027              "autocommit": false,
2028              "writeConcern": null
2029            },
2030            "command_name": "insert",
2031            "database_name": "transaction-tests"
2032          }
2033        },
2034        {
2035          "command_started_event": {
2036            "command": {
2037              "commitTransaction": 1,
2038              "lsid": "session0",
2039              "txnNumber": {
2040                "$numberLong": "1"
2041              },
2042              "startTransaction": null,
2043              "autocommit": false,
2044              "writeConcern": {
2045                "w": "majority"
2046              },
2047              "maxTimeMS": 60000
2048            },
2049            "command_name": "commitTransaction",
2050            "database_name": "admin"
2051          }
2052        },
2053        {
2054          "command_started_event": {
2055            "command": {
2056              "commitTransaction": 1,
2057              "lsid": "session0",
2058              "txnNumber": {
2059                "$numberLong": "1"
2060              },
2061              "startTransaction": null,
2062              "autocommit": false,
2063              "writeConcern": {
2064                "w": "majority",
2065                "wtimeout": 10000
2066              },
2067              "maxTimeMS": 60000
2068            },
2069            "command_name": "commitTransaction",
2070            "database_name": "admin"
2071          }
2072        }
2073      ],
2074      "outcome": {
2075        "collection": {
2076          "data": [
2077            {
2078              "_id": 1
2079            }
2080          ]
2081        }
2082      }
2083    }
2084  ]
2085}
2086