Debian Codegraph @

testdata/transactions/legacy/mongos-recovery-token.yml

raw symbols SCIP
1 runOn:
2 -
3 minServerVersion: "4.1.8"
4 topology: ["sharded"]
5 # serverless proxy doesn't use recovery tokens
6 serverless: "forbid"
7
8 database_name: &database_name "transaction-tests"
9 collection_name: &collection_name "test"
10
11 data: []
12
13 tests:
14 - description: commitTransaction explicit retries include recoveryToken
15 useMultipleMongoses: true
16 operations:
17 - name: startTransaction
18 object: session0
19 - name: insertOne
20 object: collection
21 arguments:
22 session: session0
23 document:
24 _id: 1
25 result:
26 insertedId: 1
27 - name: commitTransaction
28 object: session0
29 - name: commitTransaction
30 object: session0
31 - name: commitTransaction
32 object: session0
33
34 expectations:
35 - command_started_event:
36 command:
37 insert: *collection_name
38 documents:
39 - _id: 1
40 ordered: true
41 readConcern:
42 lsid: session0
43 txnNumber:
44 $numberLong: "1"
45 startTransaction: true
46 autocommit: false
47 writeConcern:
48 command_name: insert
49 database_name: *database_name
50 - command_started_event:
51 command:
52 commitTransaction: 1
53 lsid: session0
54 txnNumber:
55 $numberLong: "1"
56 startTransaction:
57 autocommit: false
58 writeConcern:
59 recoveryToken: 42
60 command_name: commitTransaction
61 database_name: admin
62 - command_started_event:
63 command:
64 commitTransaction: 1
65 lsid: session0
66 txnNumber:
67 $numberLong: "1"
68 startTransaction:
69 autocommit: false
70 # commitTransaction applies w:majority on retries
71 writeConcern: { w: majority, wtimeout: 10000 }
72 recoveryToken: 42
73 command_name: commitTransaction
74 database_name: admin
75 - command_started_event:
76 command:
77 commitTransaction: 1
78 lsid: session0
79 txnNumber:
80 $numberLong: "1"
81 startTransaction:
82 autocommit: false
83 # commitTransaction applies w:majority on retries
84 writeConcern: { w: majority, wtimeout: 10000 }
85 recoveryToken: 42
86 command_name: commitTransaction
87 database_name: admin
88
89 outcome:
90 collection:
91 data:
92 - _id: 1
93
94 - description: commitTransaction retry succeeds on new mongos
95 useMultipleMongoses: true
96 operations:
97 - name: startTransaction
98 object: session0
99 arguments:
100 options:
101 writeConcern:
102 w: majority
103 - name: insertOne
104 object: collection
105 arguments:
106 session: session0
107 document:
108 _id: 1
109 result:
110 insertedId: 1
111 # Enable the fail point only on the Mongos that session0 is pinned to.
112 - name: targetedFailPoint
113 object: testRunner
114 arguments:
115 session: session0
116 failPoint:
117 configureFailPoint: failCommand
118 mode: { times: 1 }
119 data:
120 failCommands: ["commitTransaction"]
121 writeConcernError:
122 code: 91
123 errmsg: Replication is being shut down
124 errorLabels: ["RetryableWriteError"]
125 # The client sees a retryable writeConcernError on the first
126 # commitTransaction due to the fail point but it actually succeeds on the
127 # server (SERVER-39346). The retry will succeed both on a new mongos and
128 # on the original.
129 - name: commitTransaction
130 object: session0
131
132 expectations:
133 - command_started_event:
134 command:
135 insert: *collection_name
136 documents:
137 - _id: 1
138 ordered: true
139 readConcern:
140 lsid: session0
141 txnNumber:
142 $numberLong: "1"
143 startTransaction: true
144 autocommit: false
145 writeConcern:
146 command_name: insert
147 database_name: *database_name
148 - command_started_event:
149 command:
150 commitTransaction: 1
151 lsid: session0
152 txnNumber:
153 $numberLong: "1"
154 startTransaction:
155 autocommit: false
156 writeConcern:
157 w: majority
158 recoveryToken: 42
159 command_name: commitTransaction
160 database_name: admin
161 - command_started_event:
162 command:
163 commitTransaction: 1
164 lsid: session0
165 txnNumber:
166 $numberLong: "1"
167 startTransaction:
168 autocommit: false
169 # commitTransaction applies w:majority on retries
170 writeConcern: { w: majority, wtimeout: 10000 }
171 recoveryToken: 42
172 command_name: commitTransaction
173 database_name: admin
174
175 outcome:
176 collection:
177 data:
178 - _id: 1
179
180 - description: commitTransaction retry fails on new mongos
181 useMultipleMongoses: true
182 clientOptions:
183 # Increase heartbeatFrequencyMS to avoid the race condition where an in
184 # flight heartbeat refreshes the first mongoes' SDAM state in between
185 # the initial commitTransaction and the retry attempt.
186 heartbeatFrequencyMS: 30000
187 operations:
188 - name: startTransaction
189 object: session0
190 - name: insertOne
191 object: collection
192 arguments:
193 session: session0
194 document:
195 _id: 1
196 result:
197 insertedId: 1
198 # Enable the fail point only on the Mongos that session0 is pinned to.
199 # Fail hello/legacy hello to prevent the heartbeat requested directly after the
200 # retryable commit error from racing with server selection for the retry.
201 # Note: times: 7 is slightly artbitrary but it accounts for one failed
202 # commit and some SDAM heartbeats. A test runner will have multiple
203 # clients connected to this server so this fail point configuration
204 # is also racy.
205 - name: targetedFailPoint
206 object: testRunner
207 arguments:
208 session: session0
209 failPoint:
210 configureFailPoint: failCommand
211 mode: { times: 7 }
212 data:
213 failCommands: ["commitTransaction", "isMaster", "hello"]
214 closeConnection: true
215 # The first commitTransaction sees a retryable connection error due to
216 # the fail point and also fails on the server. The retry attempt on a
217 # new mongos will wait for the transaction to timeout and will fail
218 # because the transaction was aborted. Note that the retry attempt should
219 # not select the original mongos because that server's SDAM state is
220 # reset by the connection error, heartbeatFrequencyMS is high, and
221 # subsequent heartbeats should fail.
222 - name: commitTransaction
223 object: session0
224 result:
225 errorLabelsContain: ["TransientTransactionError"]
226 errorLabelsOmit: ["UnknownTransactionCommitResult"]
227 errorCodeName: NoSuchTransaction
228
229 expectations:
230 - command_started_event:
231 command:
232 insert: *collection_name
233 documents:
234 - _id: 1
235 ordered: true
236 readConcern:
237 lsid: session0
238 txnNumber:
239 $numberLong: "1"
240 startTransaction: true
241 autocommit: false
242 writeConcern:
243 command_name: insert
244 database_name: *database_name
245 - command_started_event:
246 command:
247 commitTransaction: 1
248 lsid: session0
249 txnNumber:
250 $numberLong: "1"
251 startTransaction:
252 autocommit: false
253 writeConcern:
254 recoveryToken: 42
255 command_name: commitTransaction
256 database_name: admin
257 - command_started_event:
258 command:
259 commitTransaction: 1
260 lsid: session0
261 txnNumber:
262 $numberLong: "1"
263 startTransaction:
264 autocommit: false
265 # commitTransaction applies w:majority on retries
266 writeConcern: { w: majority, wtimeout: 10000 }
267 recoveryToken: 42
268 command_name: commitTransaction
269 database_name: admin
270
271 outcome:
272 collection:
273 data: []
274
275 - description: abortTransaction sends recoveryToken
276 useMultipleMongoses: true
277 operations:
278 - name: startTransaction
279 object: session0
280 - name: insertOne
281 object: collection
282 arguments:
283 session: session0
284 document:
285 _id: 1
286 result:
287 insertedId: 1
288 # Enable the fail point only on the Mongos that session0 is pinned to.
289 - name: targetedFailPoint
290 object: testRunner
291 arguments:
292 session: session0
293 failPoint:
294 configureFailPoint: failCommand
295 mode: { times: 1 }
296 data:
297 failCommands: ["abortTransaction"]
298 closeConnection: true
299 # The first abortTransaction sees a retryable connection error due to
300 # the fail point. The retry attempt on a new mongos will send the
301 # recoveryToken. Note that the retry attempt will also fail because the
302 # server does not yet support aborting from a new mongos, however this
303 # operation should "succeed" since abortTransaction ignores errors.
304 - name: abortTransaction
305 object: session0
306
307 expectations:
308 - command_started_event:
309 command:
310 insert: *collection_name
311 documents:
312 - _id: 1
313 ordered: true
314 readConcern:
315 lsid: session0
316 txnNumber:
317 $numberLong: "1"
318 startTransaction: true
319 autocommit: false
320 writeConcern:
321 command_name: insert
322 database_name: *database_name
323 - command_started_event:
324 command:
325 abortTransaction: 1
326 lsid: session0
327 txnNumber:
328 $numberLong: "1"
329 startTransaction:
330 autocommit: false
331 writeConcern:
332 recoveryToken: 42
333 command_name: abortTransaction
334 database_name: admin
335 - command_started_event:
336 command:
337 abortTransaction: 1
338 lsid: session0
339 txnNumber:
340 $numberLong: "1"
341 startTransaction:
342 autocommit: false
343 writeConcern:
344 recoveryToken: 42
345 command_name: abortTransaction
346 database_name: admin
347
348 outcome:
349 collection:
350 data: []