...
1description: "poc-retryable-reads"
2
3schemaVersion: "1.0"
4
5runOnRequirements:
6 - minServerVersion: "4.0"
7 topologies: [ single, replicaset ]
8 - minServerVersion: "4.1.7"
9 topologies: [ sharded ]
10
11createEntities:
12 - client:
13 id: &client0 client0
14 useMultipleMongoses: false
15 observeEvents: [ commandStartedEvent ]
16 - client:
17 id: &client1 client1
18 uriOptions: { retryReads: false }
19 useMultipleMongoses: false
20 observeEvents: [ commandStartedEvent ]
21 - database:
22 id: &database0 database0
23 client: *client0
24 databaseName: &databaseName retryable-reads-tests
25 - database:
26 id: &database1 database1
27 client: *client1
28 databaseName: *databaseName
29 - collection:
30 id: &collection0 collection0
31 database: *database0
32 collectionName: &collectionName coll
33 - collection:
34 id: &collection1 collection1
35 database: *database1
36 collectionName: *collectionName
37
38initialData:
39 - collectionName: *collectionName
40 databaseName: *databaseName
41 documents:
42 - {_id: 1, x: 11}
43 - {_id: 2, x: 22}
44 - {_id: 3, x: 33}
45
46tests:
47 - description: "Aggregate succeeds after InterruptedAtShutdown"
48 operations:
49 - name: failPoint
50 object: testRunner
51 arguments:
52 client: *client0
53 failPoint:
54 configureFailPoint: failCommand
55 mode: { times: 1 }
56 data:
57 failCommands: [ aggregate ]
58 errorCode: 11600 # InterruptedAtShutdown
59 - name: aggregate
60 object: *collection0
61 arguments:
62 pipeline: &pipeline
63 - $match: { _id: { $gt: 1 } }
64 - $sort: { x: 1 }
65 expectResult:
66 - { _id: 2, x: 22 }
67 - { _id: 3, x: 33 }
68 expectEvents:
69 - client: *client0
70 events:
71 - commandStartedEvent:
72 command:
73 aggregate: *collectionName
74 pipeline: *pipeline
75 databaseName: *databaseName
76 - commandStartedEvent:
77 command:
78 aggregate: *collectionName
79 pipeline: *pipeline
80 databaseName: *databaseName
81
82 - description: "Find succeeds on second attempt"
83 operations:
84 - name: failPoint
85 object: testRunner
86 arguments:
87 client: *client0
88 failPoint:
89 configureFailPoint: failCommand
90 mode: { times: 1 }
91 data:
92 failCommands: [ find ]
93 closeConnection: true
94 # Find options and expected result changed to use common initialData
95 - name: find
96 object: *collection0
97 arguments:
98 filter: {}
99 sort: { _id: 1 }
100 limit: 2
101 expectResult:
102 - { _id: 1, x: 11 }
103 - { _id: 2, x: 22 }
104 expectEvents:
105 - client: *client0
106 events:
107 - &findAttempt
108 commandStartedEvent:
109 command:
110 find: *collectionName
111 filter: {}
112 sort: { _id: 1 }
113 limit: 2
114 databaseName: *databaseName
115 - *findAttempt
116
117 - description: "Find fails on first attempt"
118 operations:
119 - name: failPoint
120 object: testRunner
121 arguments:
122 client: *client0
123 failPoint:
124 configureFailPoint: failCommand
125 mode: { times: 1 }
126 data:
127 failCommands: [ find ]
128 closeConnection: true
129 - name: find
130 object: *collection1 # client uses retryReads=false
131 arguments:
132 filter: {}
133 # Other arguments in the original test are not relevant
134 expectError: { isError: true }
135 expectEvents:
136 - client: *client1
137 events:
138 - commandStartedEvent:
139 command:
140 find: *collectionName
141 filter: {}
142 databaseName: *databaseName
143
144 - description: "Find fails on second attempt"
145 operations:
146 - name: failPoint
147 object: testRunner
148 arguments:
149 client: *client0
150 failPoint:
151 configureFailPoint: failCommand
152 mode: { times: 2 }
153 data:
154 failCommands: [ find ]
155 closeConnection: true
156 - name: find
157 object: *collection0
158 arguments:
159 filter: {}
160 # Other arguments in the original test are not relevant
161 expectError: { isError: true }
162 expectEvents:
163 - client: *client0
164 events:
165 - &findAttempt
166 commandStartedEvent:
167 command:
168 find: *collectionName
169 filter: {}
170 databaseName: *databaseName
171 - *findAttempt
172
173 - description: "ListDatabases succeeds on second attempt"
174 operations:
175 - name: failPoint
176 object: testRunner
177 arguments:
178 client: *client0
179 failPoint:
180 configureFailPoint: failCommand
181 mode: { times: 1 }
182 data:
183 failCommands: [ listDatabases ]
184 closeConnection: true
185 - name: listDatabases
186 object: *client0
187 expectEvents:
188 - client: *client0
189 events:
190 - commandStartedEvent:
191 command: { listDatabases: 1 }
192 - commandStartedEvent:
193 command: { listDatabases: 1 }
View as plain text