Skip to content

Commit 4f9ca96

Browse files
author
Divjot Arora
authored
DRIVERS-1638 Add more tests for sharded transaction unpinning (#941)
1 parent e728dfb commit 4f9ca96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+409
-7
lines changed

source/transactions/tests/README.rst

+8-4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
{
2+
"description": "mongos-unpin",
3+
"schemaVersion": "1.1",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.2",
7+
"topologies": [
8+
"sharded-replicaset"
9+
]
10+
}
11+
],
12+
"createEntities": [
13+
{
14+
"client": {
15+
"id": "client0",
16+
"useMultipleMongoses": true
17+
}
18+
},
19+
{
20+
"database": {
21+
"id": "database0",
22+
"client": "client0",
23+
"databaseName": "mongos-unpin-db"
24+
}
25+
},
26+
{
27+
"collection": {
28+
"id": "collection0",
29+
"database": "database0",
30+
"collectionName": "test"
31+
}
32+
},
33+
{
34+
"session": {
35+
"id": "session0",
36+
"client": "client0"
37+
}
38+
}
39+
],
40+
"initialData": [
41+
{
42+
"collectionName": "test",
43+
"databaseName": "mongos-unpin-db",
44+
"documents": []
45+
}
46+
],
47+
"_yamlAnchors": {
48+
"anchors": 24
49+
},
50+
"tests": [
51+
{
52+
"description": "unpin after TransientTransctionError error on commit",
53+
"operations": [
54+
{
55+
"name": "startTransaction",
56+
"object": "session0"
57+
},
58+
{
59+
"name": "insertOne",
60+
"object": "collection0",
61+
"arguments": {
62+
"document": {
63+
"x": 1
64+
},
65+
"session": "session0"
66+
}
67+
},
68+
{
69+
"name": "targetedFailPoint",
70+
"object": "testRunner",
71+
"arguments": {
72+
"session": "session0",
73+
"failPoint": {
74+
"configureFailPoint": "failCommand",
75+
"mode": {
76+
"times": 1
77+
},
78+
"data": {
79+
"failCommands": [
80+
"commitTransaction"
81+
],
82+
"errorCode": 24
83+
}
84+
}
85+
}
86+
},
87+
{
88+
"name": "commitTransaction",
89+
"object": "session0",
90+
"expectError": {
91+
"errorCode": 24,
92+
"errorLabelsContain": [
93+
"TransientTransactionError"
94+
],
95+
"errorLabelsOmit": [
96+
"UnknownTransactionCommitResult"
97+
]
98+
}
99+
},
100+
{
101+
"name": "assertSessionUnpinned",
102+
"object": "testRunner",
103+
"arguments": {
104+
"session": "session0"
105+
}
106+
}
107+
]
108+
},
109+
{
110+
"description": "unpin on successful abort",
111+
"operations": [
112+
{
113+
"name": "startTransaction",
114+
"object": "session0"
115+
},
116+
{
117+
"name": "insertOne",
118+
"object": "collection0",
119+
"arguments": {
120+
"document": {
121+
"x": 1
122+
},
123+
"session": "session0"
124+
}
125+
},
126+
{
127+
"name": "abortTransaction",
128+
"object": "session0"
129+
},
130+
{
131+
"name": "assertSessionUnpinned",
132+
"object": "testRunner",
133+
"arguments": {
134+
"session": "session0"
135+
}
136+
}
137+
]
138+
},
139+
{
140+
"description": "unpin after TransientTransctionError error on abort",
141+
"operations": [
142+
{
143+
"name": "startTransaction",
144+
"object": "session0"
145+
},
146+
{
147+
"name": "insertOne",
148+
"object": "collection0",
149+
"arguments": {
150+
"document": {
151+
"x": 1
152+
},
153+
"session": "session0"
154+
}
155+
},
156+
{
157+
"name": "targetedFailPoint",
158+
"object": "testRunner",
159+
"arguments": {
160+
"session": "session0",
161+
"failPoint": {
162+
"configureFailPoint": "failCommand",
163+
"mode": {
164+
"times": 1
165+
},
166+
"data": {
167+
"failCommands": [
168+
"abortTransaction"
169+
],
170+
"errorCode": 24
171+
}
172+
}
173+
}
174+
},
175+
{
176+
"name": "abortTransaction",
177+
"object": "session0"
178+
},
179+
{
180+
"name": "assertSessionUnpinned",
181+
"object": "testRunner",
182+
"arguments": {
183+
"session": "session0"
184+
}
185+
}
186+
]
187+
},
188+
{
189+
"description": "unpin when a new transaction is started",
190+
"operations": [
191+
{
192+
"name": "startTransaction",
193+
"object": "session0"
194+
},
195+
{
196+
"name": "insertOne",
197+
"object": "collection0",
198+
"arguments": {
199+
"document": {
200+
"x": 1
201+
},
202+
"session": "session0"
203+
}
204+
},
205+
{
206+
"name": "commitTransaction",
207+
"object": "session0"
208+
},
209+
{
210+
"name": "assertSessionPinned",
211+
"object": "testRunner",
212+
"arguments": {
213+
"session": "session0"
214+
}
215+
},
216+
{
217+
"name": "startTransaction",
218+
"object": "session0"
219+
},
220+
{
221+
"name": "assertSessionUnpinned",
222+
"object": "testRunner",
223+
"arguments": {
224+
"session": "session0"
225+
}
226+
}
227+
]
228+
},
229+
{
230+
"description": "unpin when a non-transaction operation uses a session",
231+
"operations": [
232+
{
233+
"name": "startTransaction",
234+
"object": "session0"
235+
},
236+
{
237+
"name": "insertOne",
238+
"object": "collection0",
239+
"arguments": {
240+
"document": {
241+
"x": 1
242+
},
243+
"session": "session0"
244+
}
245+
},
246+
{
247+
"name": "commitTransaction",
248+
"object": "session0"
249+
},
250+
{
251+
"name": "assertSessionPinned",
252+
"object": "testRunner",
253+
"arguments": {
254+
"session": "session0"
255+
}
256+
},
257+
{
258+
"name": "insertOne",
259+
"object": "collection0",
260+
"arguments": {
261+
"document": {
262+
"x": 1
263+
},
264+
"session": "session0"
265+
}
266+
},
267+
{
268+
"name": "assertSessionUnpinned",
269+
"object": "testRunner",
270+
"arguments": {
271+
"session": "session0"
272+
}
273+
}
274+
]
275+
}
276+
]
277+
}

0 commit comments

Comments
 (0)