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