...
1{
2 "runOn": [
3 {
4 "minServerVersion": "3.6",
5 "topology": [
6 "replicaset"
7 ]
8 }
9 ],
10 "data": [
11 {
12 "_id": 1,
13 "x": 11
14 },
15 {
16 "_id": 2,
17 "x": 22
18 }
19 ],
20 "tests": [
21 {
22 "description": "FindOneAndUpdate is committed on first attempt",
23 "failPoint": {
24 "configureFailPoint": "onPrimaryTransactionalWrite",
25 "mode": {
26 "times": 1
27 }
28 },
29 "operation": {
30 "name": "findOneAndUpdate",
31 "arguments": {
32 "filter": {
33 "_id": 1
34 },
35 "update": {
36 "$inc": {
37 "x": 1
38 }
39 },
40 "returnDocument": "Before"
41 }
42 },
43 "outcome": {
44 "result": {
45 "_id": 1,
46 "x": 11
47 },
48 "collection": {
49 "data": [
50 {
51 "_id": 1,
52 "x": 12
53 },
54 {
55 "_id": 2,
56 "x": 22
57 }
58 ]
59 }
60 }
61 },
62 {
63 "description": "FindOneAndUpdate is not committed on first attempt",
64 "failPoint": {
65 "configureFailPoint": "onPrimaryTransactionalWrite",
66 "mode": {
67 "times": 1
68 },
69 "data": {
70 "failBeforeCommitExceptionCode": 1
71 }
72 },
73 "operation": {
74 "name": "findOneAndUpdate",
75 "arguments": {
76 "filter": {
77 "_id": 1
78 },
79 "update": {
80 "$inc": {
81 "x": 1
82 }
83 },
84 "returnDocument": "Before"
85 }
86 },
87 "outcome": {
88 "result": {
89 "_id": 1,
90 "x": 11
91 },
92 "collection": {
93 "data": [
94 {
95 "_id": 1,
96 "x": 12
97 },
98 {
99 "_id": 2,
100 "x": 22
101 }
102 ]
103 }
104 }
105 },
106 {
107 "description": "FindOneAndUpdate is never committed",
108 "failPoint": {
109 "configureFailPoint": "onPrimaryTransactionalWrite",
110 "mode": {
111 "times": 2
112 },
113 "data": {
114 "failBeforeCommitExceptionCode": 1
115 }
116 },
117 "operation": {
118 "name": "findOneAndUpdate",
119 "arguments": {
120 "filter": {
121 "_id": 1
122 },
123 "update": {
124 "$inc": {
125 "x": 1
126 }
127 }
128 }
129 },
130 "outcome": {
131 "error": true,
132 "collection": {
133 "data": [
134 {
135 "_id": 1,
136 "x": 11
137 },
138 {
139 "_id": 2,
140 "x": 22
141 }
142 ]
143 }
144 }
145 }
146 ]
147}
View as plain text