Skip to content

Commit 243307b

Browse files
committed
PYTHON-1901 Avoid using readConcern snapshot in sharded txn tests
1 parent 4800512 commit 243307b

File tree

6 files changed

+216
-201
lines changed

6 files changed

+216
-201
lines changed

test/transactions-convenient-api/transaction-options.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
"session0": {
193193
"defaultTransactionOptions": {
194194
"readConcern": {
195-
"level": "snapshot"
195+
"level": "majority"
196196
},
197197
"writeConcern": {
198198
"w": 1
@@ -243,7 +243,7 @@
243243
"startTransaction": true,
244244
"autocommit": false,
245245
"readConcern": {
246-
"level": "snapshot"
246+
"level": "majority"
247247
},
248248
"writeConcern": null
249249
},
@@ -308,7 +308,7 @@
308308
},
309309
"options": {
310310
"readConcern": {
311-
"level": "snapshot"
311+
"level": "majority"
312312
},
313313
"writeConcern": {
314314
"w": 1
@@ -335,7 +335,7 @@
335335
"startTransaction": true,
336336
"autocommit": false,
337337
"readConcern": {
338-
"level": "snapshot"
338+
"level": "majority"
339339
},
340340
"writeConcern": null
341341
},
@@ -380,7 +380,7 @@
380380
"session0": {
381381
"defaultTransactionOptions": {
382382
"readConcern": {
383-
"level": "majority"
383+
"level": "snapshot"
384384
},
385385
"writeConcern": {
386386
"w": "majority"
@@ -412,7 +412,7 @@
412412
},
413413
"options": {
414414
"readConcern": {
415-
"level": "snapshot"
415+
"level": "majority"
416416
},
417417
"writeConcern": {
418418
"w": 1
@@ -439,7 +439,7 @@
439439
"startTransaction": true,
440440
"autocommit": false,
441441
"readConcern": {
442-
"level": "snapshot"
442+
"level": "majority"
443443
},
444444
"writeConcern": null
445445
},
@@ -481,7 +481,7 @@
481481
"description": "withTransaction explicit transaction options override client options",
482482
"useMultipleMongoses": true,
483483
"clientOptions": {
484-
"readConcernLevel": "majority",
484+
"readConcernLevel": "local",
485485
"w": "majority"
486486
},
487487
"operations": [
@@ -508,7 +508,7 @@
508508
},
509509
"options": {
510510
"readConcern": {
511-
"level": "snapshot"
511+
"level": "majority"
512512
},
513513
"writeConcern": {
514514
"w": 1
@@ -535,7 +535,7 @@
535535
"startTransaction": true,
536536
"autocommit": false,
537537
"readConcern": {
538-
"level": "snapshot"
538+
"level": "majority"
539539
},
540540
"writeConcern": null
541541
},

test/transactions/read-concern.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"arguments": {
4040
"options": {
4141
"readConcern": {
42-
"level": "snapshot"
42+
"level": "majority"
4343
}
4444
}
4545
}
@@ -110,7 +110,7 @@
110110
"cursor": {},
111111
"lsid": "session0",
112112
"readConcern": {
113-
"level": "snapshot"
113+
"level": "majority"
114114
},
115115
"txnNumber": {
116116
"$numberLong": "1"
@@ -202,7 +202,7 @@
202202
"arguments": {
203203
"options": {
204204
"readConcern": {
205-
"level": "snapshot"
205+
"level": "majority"
206206
}
207207
}
208208
}
@@ -274,7 +274,7 @@
274274
"batchSize": 3,
275275
"lsid": "session0",
276276
"readConcern": {
277-
"level": "snapshot"
277+
"level": "majority"
278278
},
279279
"txnNumber": {
280280
"$numberLong": "1"
@@ -389,7 +389,7 @@
389389
"arguments": {
390390
"options": {
391391
"readConcern": {
392-
"level": "snapshot"
392+
"level": "majority"
393393
}
394394
}
395395
}
@@ -484,7 +484,7 @@
484484
},
485485
"lsid": "session0",
486486
"readConcern": {
487-
"level": "snapshot"
487+
"level": "majority"
488488
},
489489
"txnNumber": {
490490
"$numberLong": "1"
@@ -608,7 +608,7 @@
608608
"arguments": {
609609
"options": {
610610
"readConcern": {
611-
"level": "snapshot"
611+
"level": "majority"
612612
}
613613
}
614614
}
@@ -664,7 +664,7 @@
664664
"key": "_id",
665665
"lsid": "session0",
666666
"readConcern": {
667-
"level": "snapshot"
667+
"level": "majority"
668668
},
669669
"txnNumber": {
670670
"$numberLong": "1"
@@ -741,7 +741,7 @@
741741
"arguments": {
742742
"options": {
743743
"readConcern": {
744-
"level": "snapshot"
744+
"level": "majority"
745745
}
746746
}
747747
}
@@ -780,7 +780,7 @@
780780
"find": "test",
781781
"lsid": "session0",
782782
"readConcern": {
783-
"level": "snapshot"
783+
"level": "majority"
784784
},
785785
"txnNumber": {
786786
"$numberLong": "1"

test/transactions/retryable-abort.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@
705705
}
706706
},
707707
{
708-
"description": "abortTransaction succeeds after InterruptedDueToStepDown",
708+
"description": "abortTransaction succeeds after InterruptedDueToReplStateChange",
709709
"failPoint": {
710710
"configureFailPoint": "failCommand",
711711
"mode": {
@@ -1627,7 +1627,7 @@
16271627
}
16281628
},
16291629
{
1630-
"description": "abortTransaction succeeds after WriteConcernError InterruptedDueToStepDown",
1630+
"description": "abortTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange",
16311631
"failPoint": {
16321632
"configureFailPoint": "failCommand",
16331633
"mode": {

test/transactions/retryable-commit.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@
942942
}
943943
},
944944
{
945-
"description": "commitTransaction succeeds after InterruptedDueToStepDown",
945+
"description": "commitTransaction succeeds after InterruptedDueToReplStateChange",
946946
"failPoint": {
947947
"configureFailPoint": "failCommand",
948948
"mode": {
@@ -1925,7 +1925,7 @@
19251925
}
19261926
},
19271927
{
1928-
"description": "commitTransaction succeeds after WriteConcernError InterruptedDueToStepDown",
1928+
"description": "commitTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange",
19291929
"failPoint": {
19301930
"configureFailPoint": "failCommand",
19311931
"mode": {
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.0",
5+
"topology": [
6+
"replicaset"
7+
]
8+
}
9+
],
10+
"database_name": "transaction-tests",
11+
"collection_name": "test",
12+
"data": [],
13+
"tests": [
14+
{
15+
"description": "readConcern snapshot in startTransaction options",
16+
"sessionOptions": {
17+
"session0": {
18+
"defaultTransactionOptions": {
19+
"readConcern": {
20+
"level": "majority"
21+
}
22+
}
23+
}
24+
},
25+
"operations": [
26+
{
27+
"name": "startTransaction",
28+
"object": "session0",
29+
"arguments": {
30+
"options": {
31+
"readConcern": {
32+
"level": "snapshot"
33+
}
34+
}
35+
}
36+
},
37+
{
38+
"name": "insertOne",
39+
"object": "collection",
40+
"arguments": {
41+
"session": "session0",
42+
"document": {
43+
"_id": 1
44+
}
45+
},
46+
"result": {
47+
"insertedId": 1
48+
}
49+
},
50+
{
51+
"name": "commitTransaction",
52+
"object": "session0"
53+
},
54+
{
55+
"name": "startTransaction",
56+
"object": "session0",
57+
"arguments": {
58+
"options": {
59+
"readConcern": {
60+
"level": "snapshot"
61+
}
62+
}
63+
}
64+
},
65+
{
66+
"name": "insertOne",
67+
"object": "collection",
68+
"arguments": {
69+
"session": "session0",
70+
"document": {
71+
"_id": 2
72+
}
73+
},
74+
"result": {
75+
"insertedId": 2
76+
}
77+
},
78+
{
79+
"name": "abortTransaction",
80+
"object": "session0"
81+
}
82+
],
83+
"expectations": [
84+
{
85+
"command_started_event": {
86+
"command": {
87+
"insert": "test",
88+
"documents": [
89+
{
90+
"_id": 1
91+
}
92+
],
93+
"ordered": true,
94+
"lsid": "session0",
95+
"txnNumber": {
96+
"$numberLong": "1"
97+
},
98+
"startTransaction": true,
99+
"autocommit": false,
100+
"readConcern": {
101+
"level": "snapshot"
102+
},
103+
"writeConcern": null
104+
},
105+
"command_name": "insert",
106+
"database_name": "transaction-tests"
107+
}
108+
},
109+
{
110+
"command_started_event": {
111+
"command": {
112+
"commitTransaction": 1,
113+
"lsid": "session0",
114+
"txnNumber": {
115+
"$numberLong": "1"
116+
},
117+
"startTransaction": null,
118+
"autocommit": false,
119+
"readConcern": null,
120+
"writeConcern": null
121+
},
122+
"command_name": "commitTransaction",
123+
"database_name": "admin"
124+
}
125+
},
126+
{
127+
"command_started_event": {
128+
"command": {
129+
"insert": "test",
130+
"documents": [
131+
{
132+
"_id": 2
133+
}
134+
],
135+
"ordered": true,
136+
"lsid": "session0",
137+
"txnNumber": {
138+
"$numberLong": "2"
139+
},
140+
"startTransaction": true,
141+
"autocommit": false,
142+
"readConcern": {
143+
"level": "snapshot",
144+
"afterClusterTime": 42
145+
},
146+
"writeConcern": null
147+
},
148+
"command_name": "insert",
149+
"database_name": "transaction-tests"
150+
}
151+
},
152+
{
153+
"command_started_event": {
154+
"command": {
155+
"abortTransaction": 1,
156+
"lsid": "session0",
157+
"txnNumber": {
158+
"$numberLong": "2"
159+
},
160+
"startTransaction": null,
161+
"autocommit": false,
162+
"readConcern": null,
163+
"writeConcern": null
164+
},
165+
"command_name": "abortTransaction",
166+
"database_name": "admin"
167+
}
168+
}
169+
],
170+
"outcome": {
171+
"collection": {
172+
"data": [
173+
{
174+
"_id": 1
175+
}
176+
]
177+
}
178+
}
179+
}
180+
]
181+
}

0 commit comments

Comments
 (0)