...
1runOn:
2 -
3 minServerVersion: "4.0"
4 topology: ["single", "replicaset"]
5 -
6 minServerVersion: "4.1.7"
7 topology: ["sharded", "load-balanced"]
8
9database_name: &database_name "retryable-reads-tests"
10collection_name: &collection_name "coll"
11
12data:
13 - {_id: 1, x: 11}
14 - {_id: 2, x: 22}
15 - {_id: 3, x: 33}
16
17tests:
18 -
19 description: "Aggregate succeeds on first attempt"
20 operations:
21 - &retryable_operation_succeeds
22 <<: &retryable_operation
23 name: aggregate
24 object: collection
25 arguments:
26 pipeline:
27 - $match: {_id: {$gt: 1}}
28 - $sort: {x: 1}
29 result:
30 - {_id: 2, x: 22}
31 - {_id: 3, x: 33}
32 expectations:
33 - &retryable_command_started_event
34 command_started_event:
35 command:
36 aggregate: *collection_name
37 pipeline: [{$match: {_id: {$gt: 1}}}, {$sort: {x: 1}}]
38 database_name: *database_name
39 -
40 description: "Aggregate succeeds on second attempt"
41 failPoint: &failCommand_failPoint
42 configureFailPoint: failCommand
43 mode: { times: 1 }
44 data:
45 failCommands: [aggregate]
46 closeConnection: true
47 operations: [*retryable_operation_succeeds]
48 expectations:
49 - *retryable_command_started_event
50 - *retryable_command_started_event
51 -
52 description: "Aggregate fails on first attempt"
53 clientOptions:
54 retryReads: false
55 failPoint: *failCommand_failPoint
56 operations:
57 - &retryable_operation_fails
58 <<: *retryable_operation
59 error: true
60 expectations:
61 - *retryable_command_started_event
62 -
63 description: "Aggregate fails on second attempt"
64 failPoint:
65 <<: *failCommand_failPoint
66 mode: { times: 2 }
67 operations: [*retryable_operation_fails]
68 expectations:
69 - *retryable_command_started_event
70 - *retryable_command_started_event
71 -
72 description: "Aggregate with $out does not retry"
73 failPoint: *failCommand_failPoint
74 operations:
75 - <<: *retryable_operation_fails
76 arguments:
77 pipeline:
78 - $match: {_id: {$gt: 1}}
79 - $sort: {x: 1}
80 - $out: "output-collection"
81 expectations:
82 - command_started_event:
83 command:
84 aggregate: *collection_name
85 pipeline: [{$match: {_id: {$gt: 1}}}, {$sort: {x: 1}}, {$out: 'output-collection'}]
86 command_name: aggregate
87 database_name: *database_name
View as plain text