Debian Codegraph @

testdata/convenient-transactions/commit-writeconcernerror.yml

raw
1 runOn:
2 -
3 minServerVersion: "4.0"
4 topology: ["replicaset"]
5 -
6 minServerVersion: "4.1.8"
7 topology: ["sharded"]
8
9 database_name: &database_name "withTransaction-tests"
10 collection_name: &collection_name "test"
11
12 data: []
13
14 tests:
15 -
16 description: commitTransaction is retried after WriteConcernFailed timeout error
17 failPoint:
18 configureFailPoint: failCommand
19 mode: { times: 2 }
20 data:
21 failCommands: ["commitTransaction"]
22 # Do not specify closeConnection: false, since that would conflict
23 # with writeConcernError (see: SERVER-39292)
24 writeConcernError:
25 code: 64
26 codeName: WriteConcernFailed
27 errmsg: "waiting for replication timed out"
28 errInfo: { wtimeout: true }
29 operations:
30 - &operation
31 name: withTransaction
32 object: session0
33 arguments:
34 callback:
35 operations:
36 -
37 name: insertOne
38 object: collection
39 arguments:
40 session: session0
41 document: { _id: 1 }
42 result:
43 insertedId: 1
44 expectations: &expectations_with_retries
45 -
46 command_started_event:
47 command:
48 insert: *collection_name
49 documents:
50 - { _id: 1 }
51 ordered: true
52 lsid: session0
53 txnNumber: { $numberLong: "1" }
54 startTransaction: true
55 autocommit: false
56 # omitted fields
57 readConcern: ~
58 writeConcern: ~
59 command_name: insert
60 database_name: *database_name
61 -
62 command_started_event:
63 command:
64 commitTransaction: 1
65 lsid: session0
66 txnNumber: { $numberLong: "1" }
67 autocommit: false
68 # omitted fields
69 readConcern: ~
70 startTransaction: ~
71 writeConcern: ~
72 command_name: commitTransaction
73 database_name: admin
74 -
75 command_started_event:
76 command:
77 commitTransaction: 1
78 lsid: session0
79 txnNumber: { $numberLong: "1" }
80 autocommit: false
81 # commitTransaction applies w:majority on retries (SPEC-1185)
82 writeConcern: { w: majority, wtimeout: 10000 }
83 # omitted fields
84 readConcern: ~
85 startTransaction: ~
86 command_name: commitTransaction
87 database_name: admin
88 -
89 command_started_event:
90 command:
91 commitTransaction: 1
92 lsid: session0
93 txnNumber: { $numberLong: "1" }
94 autocommit: false
95 # commitTransaction applies w:majority on retries (SPEC-1185)
96 writeConcern: { w: majority, wtimeout: 10000 }
97 # omitted fields
98 readConcern: ~
99 startTransaction: ~
100 command_name: commitTransaction
101 database_name: admin
102 # The write operation is still applied despite the write concern error
103 outcome: &outcome
104 collection:
105 data:
106 - { _id: 1 }
107 -
108 # This test configures the fail point to return an error with the
109 # WriteConcernFailed code but without errInfo that would identify it as a
110 # wtimeout error. This tests that drivers do not assume that all
111 # WriteConcernFailed errors are due to a replication timeout.
112 description: commitTransaction is retried after WriteConcernFailed non-timeout error
113 failPoint:
114 configureFailPoint: failCommand
115 mode: { times: 2 }
116 data:
117 failCommands: ["commitTransaction"]
118 # Do not specify closeConnection: false, since that would conflict
119 # with writeConcernError (see: SERVER-39292)
120 writeConcernError:
121 code: 64
122 codeName: WriteConcernFailed
123 errmsg: "multiple errors reported"
124 operations:
125 - *operation
126 expectations: *expectations_with_retries
127 outcome: *outcome
128 -
129 description: commitTransaction is not retried after UnknownReplWriteConcern error
130 failPoint:
131 configureFailPoint: failCommand
132 mode: { times: 1 }
133 data:
134 failCommands: ["commitTransaction"]
135 writeConcernError:
136 code: 79
137 codeName: UnknownReplWriteConcern
138 errmsg: "No write concern mode named 'foo' found in replica set configuration"
139 operations:
140 - <<: *operation
141 result:
142 errorCodeName: UnknownReplWriteConcern
143 errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
144 expectations: &expectations_without_retries
145 -
146 command_started_event:
147 command:
148 insert: *collection_name
149 documents:
150 - { _id: 1 }
151 ordered: true
152 lsid: session0
153 txnNumber: { $numberLong: "1" }
154 startTransaction: true
155 autocommit: false
156 # omitted fields
157 readConcern: ~
158 writeConcern: ~
159 command_name: insert
160 database_name: *database_name
161 -
162 command_started_event:
163 command:
164 commitTransaction: 1
165 lsid: session0
166 txnNumber: { $numberLong: "1" }
167 autocommit: false
168 # omitted fields
169 readConcern: ~
170 startTransaction: ~
171 writeConcern: ~
172 command_name: commitTransaction
173 database_name: admin
174 # failCommand with writeConcernError still applies the write operation(s)
175 outcome: *outcome
176
177 -
178 description: commitTransaction is not retried after UnsatisfiableWriteConcern error
179 failPoint:
180 configureFailPoint: failCommand
181 mode: { times: 1 }
182 data:
183 failCommands: ["commitTransaction"]
184 writeConcernError:
185 code: 100
186 codeName: UnsatisfiableWriteConcern
187 errmsg: "Not enough data-bearing nodes"
188 operations:
189 - <<: *operation
190 result:
191 errorCodeName: UnsatisfiableWriteConcern
192 errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
193 expectations: *expectations_without_retries
194 # failCommand with writeConcernError still applies the write operation(s)
195 outcome: *outcome
196
197 -
198 description: commitTransaction is not retried after MaxTimeMSExpired error
199 failPoint:
200 configureFailPoint: failCommand
201 mode: { times: 1 }
202 data:
203 failCommands: ["commitTransaction"]
204 writeConcernError:
205 code: 50
206 codeName: MaxTimeMSExpired
207 errmsg: "operation exceeded time limit"
208 operations:
209 - <<: *operation
210 result:
211 errorCodeName: MaxTimeMSExpired
212 errorLabelsContain: ["UnknownTransactionCommitResult"]
213 errorLabelsOmit: ["TransientTransactionError"]
214 expectations: *expectations_without_retries
215 # failCommand with writeConcernError still applies the write operation(s)
216 outcome: *outcome