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 "_id": 3, 30 "x": 33 31 } 32 ], 33 "tests": [ 34 { 35 "description": "Aggregate succeeds after InterruptedAtShutdown", 36 "failPoint": { 37 "configureFailPoint": "failCommand", 38 "mode": { 39 "times": 1 40 }, 41 "data": { 42 "failCommands": [ 43 "aggregate" 44 ], 45 "errorCode": 11600 46 } 47 }, 48 "operations": [ 49 { 50 "name": "aggregate", 51 "object": "collection", 52 "arguments": { 53 "pipeline": [ 54 { 55 "$match": { 56 "_id": { 57 "$gt": 1 58 } 59 } 60 }, 61 { 62 "$sort": { 63 "x": 1 64 } 65 } 66 ] 67 }, 68 "result": [ 69 { 70 "_id": 2, 71 "x": 22 72 }, 73 { 74 "_id": 3, 75 "x": 33 76 } 77 ] 78 } 79 ], 80 "expectations": [ 81 { 82 "command_started_event": { 83 "command": { 84 "aggregate": "coll", 85 "pipeline": [ 86 { 87 "$match": { 88 "_id": { 89 "$gt": 1 90 } 91 } 92 }, 93 { 94 "$sort": { 95 "x": 1 96 } 97 } 98 ] 99 }, 100 "database_name": "retryable-reads-tests" 101 } 102 }, 103 { 104 "command_started_event": { 105 "command": { 106 "aggregate": "coll", 107 "pipeline": [ 108 { 109 "$match": { 110 "_id": { 111 "$gt": 1 112 } 113 } 114 }, 115 { 116 "$sort": { 117 "x": 1 118 } 119 } 120 ] 121 }, 122 "database_name": "retryable-reads-tests" 123 } 124 } 125 ] 126 }, 127 { 128 "description": "Aggregate succeeds after InterruptedDueToReplStateChange", 129 "failPoint": { 130 "configureFailPoint": "failCommand", 131 "mode": { 132 "times": 1 133 }, 134 "data": { 135 "failCommands": [ 136 "aggregate" 137 ], 138 "errorCode": 11602 139 } 140 }, 141 "operations": [ 142 { 143 "name": "aggregate", 144 "object": "collection", 145 "arguments": { 146 "pipeline": [ 147 { 148 "$match": { 149 "_id": { 150 "$gt": 1 151 } 152 } 153 }, 154 { 155 "$sort": { 156 "x": 1 157 } 158 } 159 ] 160 }, 161 "result": [ 162 { 163 "_id": 2, 164 "x": 22 165 }, 166 { 167 "_id": 3, 168 "x": 33 169 } 170 ] 171 } 172 ], 173 "expectations": [ 174 { 175 "command_started_event": { 176 "command": { 177 "aggregate": "coll", 178 "pipeline": [ 179 { 180 "$match": { 181 "_id": { 182 "$gt": 1 183 } 184 } 185 }, 186 { 187 "$sort": { 188 "x": 1 189 } 190 } 191 ] 192 }, 193 "database_name": "retryable-reads-tests" 194 } 195 }, 196 { 197 "command_started_event": { 198 "command": { 199 "aggregate": "coll", 200 "pipeline": [ 201 { 202 "$match": { 203 "_id": { 204 "$gt": 1 205 } 206 } 207 }, 208 { 209 "$sort": { 210 "x": 1 211 } 212 } 213 ] 214 }, 215 "database_name": "retryable-reads-tests" 216 } 217 } 218 ] 219 }, 220 { 221 "description": "Aggregate succeeds after NotMaster", 222 "failPoint": { 223 "configureFailPoint": "failCommand", 224 "mode": { 225 "times": 1 226 }, 227 "data": { 228 "failCommands": [ 229 "aggregate" 230 ], 231 "errorCode": 10107 232 } 233 }, 234 "operations": [ 235 { 236 "name": "aggregate", 237 "object": "collection", 238 "arguments": { 239 "pipeline": [ 240 { 241 "$match": { 242 "_id": { 243 "$gt": 1 244 } 245 } 246 }, 247 { 248 "$sort": { 249 "x": 1 250 } 251 } 252 ] 253 }, 254 "result": [ 255 { 256 "_id": 2, 257 "x": 22 258 }, 259 { 260 "_id": 3, 261 "x": 33 262 } 263 ] 264 } 265 ], 266 "expectations": [ 267 { 268 "command_started_event": { 269 "command": { 270 "aggregate": "coll", 271 "pipeline": [ 272 { 273 "$match": { 274 "_id": { 275 "$gt": 1 276 } 277 } 278 }, 279 { 280 "$sort": { 281 "x": 1 282 } 283 } 284 ] 285 }, 286 "database_name": "retryable-reads-tests" 287 } 288 }, 289 { 290 "command_started_event": { 291 "command": { 292 "aggregate": "coll", 293 "pipeline": [ 294 { 295 "$match": { 296 "_id": { 297 "$gt": 1 298 } 299 } 300 }, 301 { 302 "$sort": { 303 "x": 1 304 } 305 } 306 ] 307 }, 308 "database_name": "retryable-reads-tests" 309 } 310 } 311 ] 312 }, 313 { 314 "description": "Aggregate succeeds after NotMasterNoSlaveOk", 315 "failPoint": { 316 "configureFailPoint": "failCommand", 317 "mode": { 318 "times": 1 319 }, 320 "data": { 321 "failCommands": [ 322 "aggregate" 323 ], 324 "errorCode": 13435 325 } 326 }, 327 "operations": [ 328 { 329 "name": "aggregate", 330 "object": "collection", 331 "arguments": { 332 "pipeline": [ 333 { 334 "$match": { 335 "_id": { 336 "$gt": 1 337 } 338 } 339 }, 340 { 341 "$sort": { 342 "x": 1 343 } 344 } 345 ] 346 }, 347 "result": [ 348 { 349 "_id": 2, 350 "x": 22 351 }, 352 { 353 "_id": 3, 354 "x": 33 355 } 356 ] 357 } 358 ], 359 "expectations": [ 360 { 361 "command_started_event": { 362 "command": { 363 "aggregate": "coll", 364 "pipeline": [ 365 { 366 "$match": { 367 "_id": { 368 "$gt": 1 369 } 370 } 371 }, 372 { 373 "$sort": { 374 "x": 1 375 } 376 } 377 ] 378 }, 379 "database_name": "retryable-reads-tests" 380 } 381 }, 382 { 383 "command_started_event": { 384 "command": { 385 "aggregate": "coll", 386 "pipeline": [ 387 { 388 "$match": { 389 "_id": { 390 "$gt": 1 391 } 392 } 393 }, 394 { 395 "$sort": { 396 "x": 1 397 } 398 } 399 ] 400 }, 401 "database_name": "retryable-reads-tests" 402 } 403 } 404 ] 405 }, 406 { 407 "description": "Aggregate succeeds after NotMasterOrSecondary", 408 "failPoint": { 409 "configureFailPoint": "failCommand", 410 "mode": { 411 "times": 1 412 }, 413 "data": { 414 "failCommands": [ 415 "aggregate" 416 ], 417 "errorCode": 13436 418 } 419 }, 420 "operations": [ 421 { 422 "name": "aggregate", 423 "object": "collection", 424 "arguments": { 425 "pipeline": [ 426 { 427 "$match": { 428 "_id": { 429 "$gt": 1 430 } 431 } 432 }, 433 { 434 "$sort": { 435 "x": 1 436 } 437 } 438 ] 439 }, 440 "result": [ 441 { 442 "_id": 2, 443 "x": 22 444 }, 445 { 446 "_id": 3, 447 "x": 33 448 } 449 ] 450 } 451 ], 452 "expectations": [ 453 { 454 "command_started_event": { 455 "command": { 456 "aggregate": "coll", 457 "pipeline": [ 458 { 459 "$match": { 460 "_id": { 461 "$gt": 1 462 } 463 } 464 }, 465 { 466 "$sort": { 467 "x": 1 468 } 469 } 470 ] 471 }, 472 "database_name": "retryable-reads-tests" 473 } 474 }, 475 { 476 "command_started_event": { 477 "command": { 478 "aggregate": "coll", 479 "pipeline": [ 480 { 481 "$match": { 482 "_id": { 483 "$gt": 1 484 } 485 } 486 }, 487 { 488 "$sort": { 489 "x": 1 490 } 491 } 492 ] 493 }, 494 "database_name": "retryable-reads-tests" 495 } 496 } 497 ] 498 }, 499 { 500 "description": "Aggregate succeeds after PrimarySteppedDown", 501 "failPoint": { 502 "configureFailPoint": "failCommand", 503 "mode": { 504 "times": 1 505 }, 506 "data": { 507 "failCommands": [ 508 "aggregate" 509 ], 510 "errorCode": 189 511 } 512 }, 513 "operations": [ 514 { 515 "name": "aggregate", 516 "object": "collection", 517 "arguments": { 518 "pipeline": [ 519 { 520 "$match": { 521 "_id": { 522 "$gt": 1 523 } 524 } 525 }, 526 { 527 "$sort": { 528 "x": 1 529 } 530 } 531 ] 532 }, 533 "result": [ 534 { 535 "_id": 2, 536 "x": 22 537 }, 538 { 539 "_id": 3, 540 "x": 33 541 } 542 ] 543 } 544 ], 545 "expectations": [ 546 { 547 "command_started_event": { 548 "command": { 549 "aggregate": "coll", 550 "pipeline": [ 551 { 552 "$match": { 553 "_id": { 554 "$gt": 1 555 } 556 } 557 }, 558 { 559 "$sort": { 560 "x": 1 561 } 562 } 563 ] 564 }, 565 "database_name": "retryable-reads-tests" 566 } 567 }, 568 { 569 "command_started_event": { 570 "command": { 571 "aggregate": "coll", 572 "pipeline": [ 573 { 574 "$match": { 575 "_id": { 576 "$gt": 1 577 } 578 } 579 }, 580 { 581 "$sort": { 582 "x": 1 583 } 584 } 585 ] 586 }, 587 "database_name": "retryable-reads-tests" 588 } 589 } 590 ] 591 }, 592 { 593 "description": "Aggregate succeeds after ShutdownInProgress", 594 "failPoint": { 595 "configureFailPoint": "failCommand", 596 "mode": { 597 "times": 1 598 }, 599 "data": { 600 "failCommands": [ 601 "aggregate" 602 ], 603 "errorCode": 91 604 } 605 }, 606 "operations": [ 607 { 608 "name": "aggregate", 609 "object": "collection", 610 "arguments": { 611 "pipeline": [ 612 { 613 "$match": { 614 "_id": { 615 "$gt": 1 616 } 617 } 618 }, 619 { 620 "$sort": { 621 "x": 1 622 } 623 } 624 ] 625 }, 626 "result": [ 627 { 628 "_id": 2, 629 "x": 22 630 }, 631 { 632 "_id": 3, 633 "x": 33 634 } 635 ] 636 } 637 ], 638 "expectations": [ 639 { 640 "command_started_event": { 641 "command": { 642 "aggregate": "coll", 643 "pipeline": [ 644 { 645 "$match": { 646 "_id": { 647 "$gt": 1 648 } 649 } 650 }, 651 { 652 "$sort": { 653 "x": 1 654 } 655 } 656 ] 657 }, 658 "database_name": "retryable-reads-tests" 659 } 660 }, 661 { 662 "command_started_event": { 663 "command": { 664 "aggregate": "coll", 665 "pipeline": [ 666 { 667 "$match": { 668 "_id": { 669 "$gt": 1 670 } 671 } 672 }, 673 { 674 "$sort": { 675 "x": 1 676 } 677 } 678 ] 679 }, 680 "database_name": "retryable-reads-tests" 681 } 682 } 683 ] 684 }, 685 { 686 "description": "Aggregate succeeds after HostNotFound", 687 "failPoint": { 688 "configureFailPoint": "failCommand", 689 "mode": { 690 "times": 1 691 }, 692 "data": { 693 "failCommands": [ 694 "aggregate" 695 ], 696 "errorCode": 7 697 } 698 }, 699 "operations": [ 700 { 701 "name": "aggregate", 702 "object": "collection", 703 "arguments": { 704 "pipeline": [ 705 { 706 "$match": { 707 "_id": { 708 "$gt": 1 709 } 710 } 711 }, 712 { 713 "$sort": { 714 "x": 1 715 } 716 } 717 ] 718 }, 719 "result": [ 720 { 721 "_id": 2, 722 "x": 22 723 }, 724 { 725 "_id": 3, 726 "x": 33 727 } 728 ] 729 } 730 ], 731 "expectations": [ 732 { 733 "command_started_event": { 734 "command": { 735 "aggregate": "coll", 736 "pipeline": [ 737 { 738 "$match": { 739 "_id": { 740 "$gt": 1 741 } 742 } 743 }, 744 { 745 "$sort": { 746 "x": 1 747 } 748 } 749 ] 750 }, 751 "database_name": "retryable-reads-tests" 752 } 753 }, 754 { 755 "command_started_event": { 756 "command": { 757 "aggregate": "coll", 758 "pipeline": [ 759 { 760 "$match": { 761 "_id": { 762 "$gt": 1 763 } 764 } 765 }, 766 { 767 "$sort": { 768 "x": 1 769 } 770 } 771 ] 772 }, 773 "database_name": "retryable-reads-tests" 774 } 775 } 776 ] 777 }, 778 { 779 "description": "Aggregate succeeds after HostUnreachable", 780 "failPoint": { 781 "configureFailPoint": "failCommand", 782 "mode": { 783 "times": 1 784 }, 785 "data": { 786 "failCommands": [ 787 "aggregate" 788 ], 789 "errorCode": 6 790 } 791 }, 792 "operations": [ 793 { 794 "name": "aggregate", 795 "object": "collection", 796 "arguments": { 797 "pipeline": [ 798 { 799 "$match": { 800 "_id": { 801 "$gt": 1 802 } 803 } 804 }, 805 { 806 "$sort": { 807 "x": 1 808 } 809 } 810 ] 811 }, 812 "result": [ 813 { 814 "_id": 2, 815 "x": 22 816 }, 817 { 818 "_id": 3, 819 "x": 33 820 } 821 ] 822 } 823 ], 824 "expectations": [ 825 { 826 "command_started_event": { 827 "command": { 828 "aggregate": "coll", 829 "pipeline": [ 830 { 831 "$match": { 832 "_id": { 833 "$gt": 1 834 } 835 } 836 }, 837 { 838 "$sort": { 839 "x": 1 840 } 841 } 842 ] 843 }, 844 "database_name": "retryable-reads-tests" 845 } 846 }, 847 { 848 "command_started_event": { 849 "command": { 850 "aggregate": "coll", 851 "pipeline": [ 852 { 853 "$match": { 854 "_id": { 855 "$gt": 1 856 } 857 } 858 }, 859 { 860 "$sort": { 861 "x": 1 862 } 863 } 864 ] 865 }, 866 "database_name": "retryable-reads-tests" 867 } 868 } 869 ] 870 }, 871 { 872 "description": "Aggregate succeeds after NetworkTimeout", 873 "failPoint": { 874 "configureFailPoint": "failCommand", 875 "mode": { 876 "times": 1 877 }, 878 "data": { 879 "failCommands": [ 880 "aggregate" 881 ], 882 "errorCode": 89 883 } 884 }, 885 "operations": [ 886 { 887 "name": "aggregate", 888 "object": "collection", 889 "arguments": { 890 "pipeline": [ 891 { 892 "$match": { 893 "_id": { 894 "$gt": 1 895 } 896 } 897 }, 898 { 899 "$sort": { 900 "x": 1 901 } 902 } 903 ] 904 }, 905 "result": [ 906 { 907 "_id": 2, 908 "x": 22 909 }, 910 { 911 "_id": 3, 912 "x": 33 913 } 914 ] 915 } 916 ], 917 "expectations": [ 918 { 919 "command_started_event": { 920 "command": { 921 "aggregate": "coll", 922 "pipeline": [ 923 { 924 "$match": { 925 "_id": { 926 "$gt": 1 927 } 928 } 929 }, 930 { 931 "$sort": { 932 "x": 1 933 } 934 } 935 ] 936 }, 937 "database_name": "retryable-reads-tests" 938 } 939 }, 940 { 941 "command_started_event": { 942 "command": { 943 "aggregate": "coll", 944 "pipeline": [ 945 { 946 "$match": { 947 "_id": { 948 "$gt": 1 949 } 950 } 951 }, 952 { 953 "$sort": { 954 "x": 1 955 } 956 } 957 ] 958 }, 959 "database_name": "retryable-reads-tests" 960 } 961 } 962 ] 963 }, 964 { 965 "description": "Aggregate succeeds after SocketException", 966 "failPoint": { 967 "configureFailPoint": "failCommand", 968 "mode": { 969 "times": 1 970 }, 971 "data": { 972 "failCommands": [ 973 "aggregate" 974 ], 975 "errorCode": 9001 976 } 977 }, 978 "operations": [ 979 { 980 "name": "aggregate", 981 "object": "collection", 982 "arguments": { 983 "pipeline": [ 984 { 985 "$match": { 986 "_id": { 987 "$gt": 1 988 } 989 } 990 }, 991 { 992 "$sort": { 993 "x": 1 994 } 995 } 996 ] 997 }, 998 "result": [ 999 { 1000 "_id": 2, 1001 "x": 22 1002 }, 1003 { 1004 "_id": 3, 1005 "x": 33 1006 } 1007 ] 1008 } 1009 ], 1010 "expectations": [ 1011 { 1012 "command_started_event": { 1013 "command": { 1014 "aggregate": "coll", 1015 "pipeline": [ 1016 { 1017 "$match": { 1018 "_id": { 1019 "$gt": 1 1020 } 1021 } 1022 }, 1023 { 1024 "$sort": { 1025 "x": 1 1026 } 1027 } 1028 ] 1029 }, 1030 "database_name": "retryable-reads-tests" 1031 } 1032 }, 1033 { 1034 "command_started_event": { 1035 "command": { 1036 "aggregate": "coll", 1037 "pipeline": [ 1038 { 1039 "$match": { 1040 "_id": { 1041 "$gt": 1 1042 } 1043 } 1044 }, 1045 { 1046 "$sort": { 1047 "x": 1 1048 } 1049 } 1050 ] 1051 }, 1052 "database_name": "retryable-reads-tests" 1053 } 1054 } 1055 ] 1056 }, 1057 { 1058 "description": "Aggregate fails after two NotMaster errors", 1059 "failPoint": { 1060 "configureFailPoint": "failCommand", 1061 "mode": { 1062 "times": 2 1063 }, 1064 "data": { 1065 "failCommands": [ 1066 "aggregate" 1067 ], 1068 "errorCode": 10107 1069 } 1070 }, 1071 "operations": [ 1072 { 1073 "name": "aggregate", 1074 "object": "collection", 1075 "arguments": { 1076 "pipeline": [ 1077 { 1078 "$match": { 1079 "_id": { 1080 "$gt": 1 1081 } 1082 } 1083 }, 1084 { 1085 "$sort": { 1086 "x": 1 1087 } 1088 } 1089 ] 1090 }, 1091 "error": true 1092 } 1093 ], 1094 "expectations": [ 1095 { 1096 "command_started_event": { 1097 "command": { 1098 "aggregate": "coll", 1099 "pipeline": [ 1100 { 1101 "$match": { 1102 "_id": { 1103 "$gt": 1 1104 } 1105 } 1106 }, 1107 { 1108 "$sort": { 1109 "x": 1 1110 } 1111 } 1112 ] 1113 }, 1114 "database_name": "retryable-reads-tests" 1115 } 1116 }, 1117 { 1118 "command_started_event": { 1119 "command": { 1120 "aggregate": "coll", 1121 "pipeline": [ 1122 { 1123 "$match": { 1124 "_id": { 1125 "$gt": 1 1126 } 1127 } 1128 }, 1129 { 1130 "$sort": { 1131 "x": 1 1132 } 1133 } 1134 ] 1135 }, 1136 "database_name": "retryable-reads-tests" 1137 } 1138 } 1139 ] 1140 }, 1141 { 1142 "description": "Aggregate fails after NotMaster when retryReads is false", 1143 "clientOptions": { 1144 "retryReads": false 1145 }, 1146 "failPoint": { 1147 "configureFailPoint": "failCommand", 1148 "mode": { 1149 "times": 1 1150 }, 1151 "data": { 1152 "failCommands": [ 1153 "aggregate" 1154 ], 1155 "errorCode": 10107 1156 } 1157 }, 1158 "operations": [ 1159 { 1160 "name": "aggregate", 1161 "object": "collection", 1162 "arguments": { 1163 "pipeline": [ 1164 { 1165 "$match": { 1166 "_id": { 1167 "$gt": 1 1168 } 1169 } 1170 }, 1171 { 1172 "$sort": { 1173 "x": 1 1174 } 1175 } 1176 ] 1177 }, 1178 "error": true 1179 } 1180 ], 1181 "expectations": [ 1182 { 1183 "command_started_event": { 1184 "command": { 1185 "aggregate": "coll", 1186 "pipeline": [ 1187 { 1188 "$match": { 1189 "_id": { 1190 "$gt": 1 1191 } 1192 } 1193 }, 1194 { 1195 "$sort": { 1196 "x": 1 1197 } 1198 } 1199 ] 1200 }, 1201 "database_name": "retryable-reads-tests" 1202 } 1203 } 1204 ] 1205 } 1206 ] 1207} 1208