| 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 "transaction-tests" |
| 10 |
collection_name: &collection_name "test" |
| 11 |
|
| 12 |
data: [] |
| 13 |
|
| 14 |
tests: |
| 15 |
- description: increment txnNumber |
| 16 |
|
| 17 |
clientOptions: |
| 18 |
retryWrites: true |
| 19 |
|
| 20 |
operations: |
| 21 |
- name: startTransaction |
| 22 |
object: session0 |
| 23 |
- name: insertOne |
| 24 |
object: collection |
| 25 |
arguments: |
| 26 |
session: session0 |
| 27 |
document: |
| 28 |
_id: 1 |
| 29 |
result: |
| 30 |
insertedId: 1 |
| 31 |
- name: commitTransaction |
| 32 |
object: session0 |
| 33 |
|
| 34 |
- name: insertOne |
| 35 |
object: collection |
| 36 |
arguments: |
| 37 |
session: session0 |
| 38 |
document: |
| 39 |
_id: 2 |
| 40 |
result: |
| 41 |
insertedId: 2 |
| 42 |
|
| 43 |
- name: startTransaction |
| 44 |
object: session0 |
| 45 |
- name: insertOne |
| 46 |
object: collection |
| 47 |
arguments: |
| 48 |
session: session0 |
| 49 |
document: |
| 50 |
_id: 3 |
| 51 |
result: |
| 52 |
insertedId: 3 |
| 53 |
- name: abortTransaction |
| 54 |
object: session0 |
| 55 |
|
| 56 |
- name: insertMany |
| 57 |
object: collection |
| 58 |
arguments: |
| 59 |
documents: |
| 60 |
- _id: 4 |
| 61 |
- _id: 5 |
| 62 |
session: session0 |
| 63 |
result: |
| 64 |
insertedIds: {0: 4, 1: 5} |
| 65 |
|
| 66 |
expectations: |
| 67 |
- command_started_event: |
| 68 |
command: |
| 69 |
insert: *collection_name |
| 70 |
documents: |
| 71 |
- _id: 1 |
| 72 |
ordered: true |
| 73 |
readConcern: |
| 74 |
lsid: session0 |
| 75 |
txnNumber: |
| 76 |
$numberLong: "1" |
| 77 |
startTransaction: true |
| 78 |
autocommit: false |
| 79 |
writeConcern: |
| 80 |
command_name: insert |
| 81 |
database_name: *database_name |
| 82 |
- command_started_event: |
| 83 |
command: |
| 84 |
commitTransaction: 1 |
| 85 |
lsid: session0 |
| 86 |
txnNumber: |
| 87 |
$numberLong: "1" |
| 88 |
startTransaction: |
| 89 |
autocommit: false |
| 90 |
writeConcern: |
| 91 |
command_name: commitTransaction |
| 92 |
database_name: admin |
| 93 |
- command_started_event: |
| 94 |
command: |
| 95 |
insert: *collection_name |
| 96 |
documents: |
| 97 |
- _id: 2 |
| 98 |
ordered: true |
| 99 |
readConcern: |
| 100 |
lsid: session0 |
| 101 |
txnNumber: |
| 102 |
$numberLong: "2" |
| 103 |
startTransaction: |
| 104 |
autocommit: |
| 105 |
writeConcern: |
| 106 |
command_name: insert |
| 107 |
database_name: *database_name |
| 108 |
- command_started_event: |
| 109 |
command: |
| 110 |
insert: *collection_name |
| 111 |
documents: |
| 112 |
- _id: 3 |
| 113 |
ordered: true |
| 114 |
readConcern: |
| 115 |
afterClusterTime: 42 |
| 116 |
lsid: session0 |
| 117 |
txnNumber: |
| 118 |
$numberLong: "3" |
| 119 |
startTransaction: true |
| 120 |
autocommit: false |
| 121 |
writeConcern: |
| 122 |
command_name: insert |
| 123 |
database_name: *database_name |
| 124 |
- command_started_event: |
| 125 |
command: |
| 126 |
abortTransaction: 1 |
| 127 |
lsid: session0 |
| 128 |
txnNumber: |
| 129 |
$numberLong: "3" |
| 130 |
startTransaction: |
| 131 |
autocommit: false |
| 132 |
writeConcern: |
| 133 |
command_name: abortTransaction |
| 134 |
database_name: admin |
| 135 |
- command_started_event: |
| 136 |
command: |
| 137 |
insert: *collection_name |
| 138 |
documents: |
| 139 |
- _id: 4 |
| 140 |
- _id: 5 |
| 141 |
ordered: true |
| 142 |
readConcern: |
| 143 |
lsid: session0 |
| 144 |
txnNumber: |
| 145 |
$numberLong: "4" |
| 146 |
startTransaction: |
| 147 |
autocommit: |
| 148 |
writeConcern: |
| 149 |
command_name: insert |
| 150 |
database_name: *database_name |
| 151 |
|
| 152 |
outcome: |
| 153 |
collection: |
| 154 |
data: |
| 155 |
- _id: 1 |
| 156 |
- _id: 2 |
| 157 |
- _id: 4 |
| 158 |
- _id: 5 |
| 159 |
|
| 160 |
- description: writes are not retried |
| 161 |
|
| 162 |
clientOptions: |
| 163 |
retryWrites: true |
| 164 |
|
| 165 |
failPoint: |
| 166 |
configureFailPoint: failCommand |
| 167 |
mode: { times: 1 } |
| 168 |
data: |
| 169 |
failCommands: ["insert"] |
| 170 |
closeConnection: true |
| 171 |
|
| 172 |
operations: |
| 173 |
- name: startTransaction |
| 174 |
object: session0 |
| 175 |
- name: insertOne |
| 176 |
object: collection |
| 177 |
arguments: |
| 178 |
session: session0 |
| 179 |
document: |
| 180 |
_id: 1 |
| 181 |
result: |
| 182 |
errorLabelsContain: ["TransientTransactionError"] |
| 183 |
- name: abortTransaction |
| 184 |
object: session0 |
| 185 |
|
| 186 |
expectations: |
| 187 |
- command_started_event: |
| 188 |
command: |
| 189 |
insert: *collection_name |
| 190 |
documents: |
| 191 |
- _id: 1 |
| 192 |
ordered: true |
| 193 |
readConcern: |
| 194 |
lsid: session0 |
| 195 |
txnNumber: |
| 196 |
$numberLong: "1" |
| 197 |
startTransaction: true |
| 198 |
autocommit: false |
| 199 |
writeConcern: |
| 200 |
command_name: insert |
| 201 |
database_name: *database_name |
| 202 |
- command_started_event: |
| 203 |
command: |
| 204 |
abortTransaction: 1 |
| 205 |
lsid: session0 |
| 206 |
txnNumber: |
| 207 |
$numberLong: "1" |
| 208 |
startTransaction: |
| 209 |
autocommit: false |
| 210 |
writeConcern: |
| 211 |
command_name: abortTransaction |
| 212 |
database_name: admin |
| 213 |
|
| 214 |
outcome: |
| 215 |
collection: |
| 216 |
data: [] |