1{ 2 "runOn": [ 3 { 4 "minServerVersion": "4.0", 5 "topology": [ 6 "replicaset" 7 ] 8 }, 9 { 10 "minServerVersion": "4.1.8", 11 "topology": [ 12 "sharded" 13 ] 14 } 15 ], 16 "database_name": "withTransaction-tests", 17 "collection_name": "test", 18 "data": [], 19 "tests": [ 20 { 21 "description": "commitTransaction succeeds after multiple connection errors", 22 "failPoint": { 23 "configureFailPoint": "failCommand", 24 "mode": { 25 "times": 2 26 }, 27 "data": { 28 "failCommands": [ 29 "commitTransaction" 30 ], 31 "closeConnection": true 32 } 33 }, 34 "operations": [ 35 { 36 "name": "withTransaction", 37 "object": "session0", 38 "arguments": { 39 "callback": { 40 "operations": [ 41 { 42 "name": "insertOne", 43 "object": "collection", 44 "arguments": { 45 "session": "session0", 46 "document": { 47 "_id": 1 48 } 49 }, 50 "result": { 51 "insertedId": 1 52 } 53 } 54 ] 55 } 56 } 57 } 58 ], 59 "expectations": [ 60 { 61 "command_started_event": { 62 "command": { 63 "insert": "test", 64 "documents": [ 65 { 66 "_id": 1 67 } 68 ], 69 "ordered": true, 70 "lsid": "session0", 71 "txnNumber": { 72 "$numberLong": "1" 73 }, 74 "startTransaction": true, 75 "autocommit": false, 76 "readConcern": null, 77 "writeConcern": null 78 }, 79 "command_name": "insert", 80 "database_name": "withTransaction-tests" 81 } 82 }, 83 { 84 "command_started_event": { 85 "command": { 86 "commitTransaction": 1, 87 "lsid": "session0", 88 "txnNumber": { 89 "$numberLong": "1" 90 }, 91 "autocommit": false, 92 "readConcern": null, 93 "startTransaction": null, 94 "writeConcern": null 95 }, 96 "command_name": "commitTransaction", 97 "database_name": "admin" 98 } 99 }, 100 { 101 "command_started_event": { 102 "command": { 103 "commitTransaction": 1, 104 "lsid": "session0", 105 "txnNumber": { 106 "$numberLong": "1" 107 }, 108 "autocommit": false, 109 "writeConcern": { 110 "w": "majority", 111 "wtimeout": 10000 112 }, 113 "readConcern": null, 114 "startTransaction": null 115 }, 116 "command_name": "commitTransaction", 117 "database_name": "admin" 118 } 119 }, 120 { 121 "command_started_event": { 122 "command": { 123 "commitTransaction": 1, 124 "lsid": "session0", 125 "txnNumber": { 126 "$numberLong": "1" 127 }, 128 "autocommit": false, 129 "writeConcern": { 130 "w": "majority", 131 "wtimeout": 10000 132 }, 133 "readConcern": null, 134 "startTransaction": null 135 }, 136 "command_name": "commitTransaction", 137 "database_name": "admin" 138 } 139 } 140 ], 141 "outcome": { 142 "collection": { 143 "data": [ 144 { 145 "_id": 1 146 } 147 ] 148 } 149 } 150 }, 151 { 152 "description": "commitTransaction retry only overwrites write concern w option", 153 "failPoint": { 154 "configureFailPoint": "failCommand", 155 "mode": { 156 "times": 2 157 }, 158 "data": { 159 "failCommands": [ 160 "commitTransaction" 161 ], 162 "closeConnection": true 163 } 164 }, 165 "operations": [ 166 { 167 "name": "withTransaction", 168 "object": "session0", 169 "arguments": { 170 "callback": { 171 "operations": [ 172 { 173 "name": "insertOne", 174 "object": "collection", 175 "arguments": { 176 "session": "session0", 177 "document": { 178 "_id": 1 179 } 180 }, 181 "result": { 182 "insertedId": 1 183 } 184 } 185 ] 186 }, 187 "options": { 188 "writeConcern": { 189 "w": 2, 190 "j": true, 191 "wtimeout": 5000 192 } 193 } 194 } 195 } 196 ], 197 "expectations": [ 198 { 199 "command_started_event": { 200 "command": { 201 "insert": "test", 202 "documents": [ 203 { 204 "_id": 1 205 } 206 ], 207 "ordered": true, 208 "lsid": "session0", 209 "txnNumber": { 210 "$numberLong": "1" 211 }, 212 "startTransaction": true, 213 "autocommit": false, 214 "readConcern": null, 215 "writeConcern": null 216 }, 217 "command_name": "insert", 218 "database_name": "withTransaction-tests" 219 } 220 }, 221 { 222 "command_started_event": { 223 "command": { 224 "commitTransaction": 1, 225 "lsid": "session0", 226 "txnNumber": { 227 "$numberLong": "1" 228 }, 229 "autocommit": false, 230 "writeConcern": { 231 "w": 2, 232 "j": true, 233 "wtimeout": 5000 234 }, 235 "readConcern": null, 236 "startTransaction": null 237 }, 238 "command_name": "commitTransaction", 239 "database_name": "admin" 240 } 241 }, 242 { 243 "command_started_event": { 244 "command": { 245 "commitTransaction": 1, 246 "lsid": "session0", 247 "txnNumber": { 248 "$numberLong": "1" 249 }, 250 "autocommit": false, 251 "writeConcern": { 252 "w": "majority", 253 "j": true, 254 "wtimeout": 5000 255 }, 256 "readConcern": null, 257 "startTransaction": null 258 }, 259 "command_name": "commitTransaction", 260 "database_name": "admin" 261 } 262 }, 263 { 264 "command_started_event": { 265 "command": { 266 "commitTransaction": 1, 267 "lsid": "session0", 268 "txnNumber": { 269 "$numberLong": "1" 270 }, 271 "autocommit": false, 272 "writeConcern": { 273 "w": "majority", 274 "j": true, 275 "wtimeout": 5000 276 }, 277 "readConcern": null, 278 "startTransaction": null 279 }, 280 "command_name": "commitTransaction", 281 "database_name": "admin" 282 } 283 } 284 ], 285 "outcome": { 286 "collection": { 287 "data": [ 288 { 289 "_id": 1 290 } 291 ] 292 } 293 } 294 }, 295 { 296 "description": "commit is retried after commitTransaction UnknownTransactionCommitResult (NotMaster)", 297 "failPoint": { 298 "configureFailPoint": "failCommand", 299 "mode": { 300 "times": 2 301 }, 302 "data": { 303 "failCommands": [ 304 "commitTransaction" 305 ], 306 "errorCode": 10107, 307 "closeConnection": false 308 } 309 }, 310 "operations": [ 311 { 312 "name": "withTransaction", 313 "object": "session0", 314 "arguments": { 315 "callback": { 316 "operations": [ 317 { 318 "name": "insertOne", 319 "object": "collection", 320 "arguments": { 321 "session": "session0", 322 "document": { 323 "_id": 1 324 } 325 }, 326 "result": { 327 "insertedId": 1 328 } 329 } 330 ] 331 } 332 } 333 } 334 ], 335 "expectations": [ 336 { 337 "command_started_event": { 338 "command": { 339 "insert": "test", 340 "documents": [ 341 { 342 "_id": 1 343 } 344 ], 345 "ordered": true, 346 "lsid": "session0", 347 "txnNumber": { 348 "$numberLong": "1" 349 }, 350 "startTransaction": true, 351 "autocommit": false, 352 "readConcern": null, 353 "writeConcern": null 354 }, 355 "command_name": "insert", 356 "database_name": "withTransaction-tests" 357 } 358 }, 359 { 360 "command_started_event": { 361 "command": { 362 "commitTransaction": 1, 363 "lsid": "session0", 364 "txnNumber": { 365 "$numberLong": "1" 366 }, 367 "autocommit": false, 368 "readConcern": null, 369 "startTransaction": null, 370 "writeConcern": null 371 }, 372 "command_name": "commitTransaction", 373 "database_name": "admin" 374 } 375 }, 376 { 377 "command_started_event": { 378 "command": { 379 "commitTransaction": 1, 380 "lsid": "session0", 381 "txnNumber": { 382 "$numberLong": "1" 383 }, 384 "autocommit": false, 385 "writeConcern": { 386 "w": "majority", 387 "wtimeout": 10000 388 }, 389 "readConcern": null, 390 "startTransaction": null 391 }, 392 "command_name": "commitTransaction", 393 "database_name": "admin" 394 } 395 }, 396 { 397 "command_started_event": { 398 "command": { 399 "commitTransaction": 1, 400 "lsid": "session0", 401 "txnNumber": { 402 "$numberLong": "1" 403 }, 404 "autocommit": false, 405 "writeConcern": { 406 "w": "majority", 407 "wtimeout": 10000 408 }, 409 "readConcern": null, 410 "startTransaction": null 411 }, 412 "command_name": "commitTransaction", 413 "database_name": "admin" 414 } 415 } 416 ], 417 "outcome": { 418 "collection": { 419 "data": [ 420 { 421 "_id": 1 422 } 423 ] 424 } 425 } 426 }, 427 { 428 "description": "commit is not retried after MaxTimeMSExpired error", 429 "failPoint": { 430 "configureFailPoint": "failCommand", 431 "mode": { 432 "times": 1 433 }, 434 "data": { 435 "failCommands": [ 436 "commitTransaction" 437 ], 438 "errorCode": 50 439 } 440 }, 441 "operations": [ 442 { 443 "name": "withTransaction", 444 "object": "session0", 445 "arguments": { 446 "callback": { 447 "operations": [ 448 { 449 "name": "insertOne", 450 "object": "collection", 451 "arguments": { 452 "session": "session0", 453 "document": { 454 "_id": 1 455 } 456 }, 457 "result": { 458 "insertedId": 1 459 } 460 } 461 ] 462 }, 463 "options": { 464 "maxCommitTimeMS": 60000 465 } 466 }, 467 "result": { 468 "errorCodeName": "MaxTimeMSExpired", 469 "errorLabelsContain": [ 470 "UnknownTransactionCommitResult" 471 ], 472 "errorLabelsOmit": [ 473 "TransientTransactionError" 474 ] 475 } 476 } 477 ], 478 "expectations": [ 479 { 480 "command_started_event": { 481 "command": { 482 "insert": "test", 483 "documents": [ 484 { 485 "_id": 1 486 } 487 ], 488 "ordered": true, 489 "lsid": "session0", 490 "txnNumber": { 491 "$numberLong": "1" 492 }, 493 "startTransaction": true, 494 "autocommit": false, 495 "readConcern": null, 496 "writeConcern": null 497 }, 498 "command_name": "insert", 499 "database_name": "withTransaction-tests" 500 } 501 }, 502 { 503 "command_started_event": { 504 "command": { 505 "commitTransaction": 1, 506 "lsid": "session0", 507 "txnNumber": { 508 "$numberLong": "1" 509 }, 510 "autocommit": false, 511 "maxTimeMS": 60000, 512 "readConcern": null, 513 "startTransaction": null, 514 "writeConcern": null 515 }, 516 "command_name": "commitTransaction", 517 "database_name": "admin" 518 } 519 } 520 ], 521 "outcome": { 522 "collection": { 523 "data": [] 524 } 525 } 526 } 527 ] 528} 529