...

Text file src/go.mongodb.org/mongo-driver/testdata/convenient-transactions/commit-transienttransactionerror.json

Documentation: go.mongodb.org/mongo-driver/testdata/convenient-transactions

     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": "transaction is retried after commitTransaction TransientTransactionError (LockTimeout)",
    22      "failPoint": {
    23        "configureFailPoint": "failCommand",
    24        "mode": {
    25          "times": 2
    26        },
    27        "data": {
    28          "failCommands": [
    29            "commitTransaction"
    30          ],
    31          "errorCode": 24,
    32          "closeConnection": false
    33        }
    34      },
    35      "operations": [
    36        {
    37          "name": "withTransaction",
    38          "object": "session0",
    39          "arguments": {
    40            "callback": {
    41              "operations": [
    42                {
    43                  "name": "insertOne",
    44                  "object": "collection",
    45                  "arguments": {
    46                    "session": "session0",
    47                    "document": {
    48                      "_id": 1
    49                    }
    50                  },
    51                  "result": {
    52                    "insertedId": 1
    53                  }
    54                }
    55              ]
    56            }
    57          }
    58        }
    59      ],
    60      "expectations": [
    61        {
    62          "command_started_event": {
    63            "command": {
    64              "insert": "test",
    65              "documents": [
    66                {
    67                  "_id": 1
    68                }
    69              ],
    70              "ordered": true,
    71              "lsid": "session0",
    72              "txnNumber": {
    73                "$numberLong": "1"
    74              },
    75              "startTransaction": true,
    76              "autocommit": false,
    77              "readConcern": null,
    78              "writeConcern": null
    79            },
    80            "command_name": "insert",
    81            "database_name": "withTransaction-tests"
    82          }
    83        },
    84        {
    85          "command_started_event": {
    86            "command": {
    87              "commitTransaction": 1,
    88              "lsid": "session0",
    89              "txnNumber": {
    90                "$numberLong": "1"
    91              },
    92              "autocommit": false,
    93              "readConcern": null,
    94              "startTransaction": null,
    95              "writeConcern": null
    96            },
    97            "command_name": "commitTransaction",
    98            "database_name": "admin"
    99          }
   100        },
   101        {
   102          "command_started_event": {
   103            "command": {
   104              "insert": "test",
   105              "documents": [
   106                {
   107                  "_id": 1
   108                }
   109              ],
   110              "ordered": true,
   111              "lsid": "session0",
   112              "readConcern": {
   113                "afterClusterTime": 42
   114              },
   115              "txnNumber": {
   116                "$numberLong": "2"
   117              },
   118              "startTransaction": true,
   119              "autocommit": false,
   120              "writeConcern": null
   121            },
   122            "command_name": "insert",
   123            "database_name": "withTransaction-tests"
   124          }
   125        },
   126        {
   127          "command_started_event": {
   128            "command": {
   129              "commitTransaction": 1,
   130              "lsid": "session0",
   131              "txnNumber": {
   132                "$numberLong": "2"
   133              },
   134              "autocommit": false,
   135              "readConcern": null,
   136              "startTransaction": null,
   137              "writeConcern": null
   138            },
   139            "command_name": "commitTransaction",
   140            "database_name": "admin"
   141          }
   142        },
   143        {
   144          "command_started_event": {
   145            "command": {
   146              "insert": "test",
   147              "documents": [
   148                {
   149                  "_id": 1
   150                }
   151              ],
   152              "ordered": true,
   153              "lsid": "session0",
   154              "readConcern": {
   155                "afterClusterTime": 42
   156              },
   157              "txnNumber": {
   158                "$numberLong": "3"
   159              },
   160              "startTransaction": true,
   161              "autocommit": false,
   162              "writeConcern": null
   163            },
   164            "command_name": "insert",
   165            "database_name": "withTransaction-tests"
   166          }
   167        },
   168        {
   169          "command_started_event": {
   170            "command": {
   171              "commitTransaction": 1,
   172              "lsid": "session0",
   173              "txnNumber": {
   174                "$numberLong": "3"
   175              },
   176              "autocommit": false,
   177              "readConcern": null,
   178              "startTransaction": null,
   179              "writeConcern": null
   180            },
   181            "command_name": "commitTransaction",
   182            "database_name": "admin"
   183          }
   184        }
   185      ],
   186      "outcome": {
   187        "collection": {
   188          "data": [
   189            {
   190              "_id": 1
   191            }
   192          ]
   193        }
   194      }
   195    },
   196    {
   197      "description": "transaction is retried after commitTransaction TransientTransactionError (WriteConflict)",
   198      "failPoint": {
   199        "configureFailPoint": "failCommand",
   200        "mode": {
   201          "times": 2
   202        },
   203        "data": {
   204          "failCommands": [
   205            "commitTransaction"
   206          ],
   207          "errorCode": 112,
   208          "closeConnection": false
   209        }
   210      },
   211      "operations": [
   212        {
   213          "name": "withTransaction",
   214          "object": "session0",
   215          "arguments": {
   216            "callback": {
   217              "operations": [
   218                {
   219                  "name": "insertOne",
   220                  "object": "collection",
   221                  "arguments": {
   222                    "session": "session0",
   223                    "document": {
   224                      "_id": 1
   225                    }
   226                  },
   227                  "result": {
   228                    "insertedId": 1
   229                  }
   230                }
   231              ]
   232            }
   233          }
   234        }
   235      ],
   236      "expectations": [
   237        {
   238          "command_started_event": {
   239            "command": {
   240              "insert": "test",
   241              "documents": [
   242                {
   243                  "_id": 1
   244                }
   245              ],
   246              "ordered": true,
   247              "lsid": "session0",
   248              "txnNumber": {
   249                "$numberLong": "1"
   250              },
   251              "startTransaction": true,
   252              "autocommit": false,
   253              "readConcern": null,
   254              "writeConcern": null
   255            },
   256            "command_name": "insert",
   257            "database_name": "withTransaction-tests"
   258          }
   259        },
   260        {
   261          "command_started_event": {
   262            "command": {
   263              "commitTransaction": 1,
   264              "lsid": "session0",
   265              "txnNumber": {
   266                "$numberLong": "1"
   267              },
   268              "autocommit": false,
   269              "readConcern": null,
   270              "startTransaction": null,
   271              "writeConcern": null
   272            },
   273            "command_name": "commitTransaction",
   274            "database_name": "admin"
   275          }
   276        },
   277        {
   278          "command_started_event": {
   279            "command": {
   280              "insert": "test",
   281              "documents": [
   282                {
   283                  "_id": 1
   284                }
   285              ],
   286              "ordered": true,
   287              "lsid": "session0",
   288              "readConcern": {
   289                "afterClusterTime": 42
   290              },
   291              "txnNumber": {
   292                "$numberLong": "2"
   293              },
   294              "startTransaction": true,
   295              "autocommit": false,
   296              "writeConcern": null
   297            },
   298            "command_name": "insert",
   299            "database_name": "withTransaction-tests"
   300          }
   301        },
   302        {
   303          "command_started_event": {
   304            "command": {
   305              "commitTransaction": 1,
   306              "lsid": "session0",
   307              "txnNumber": {
   308                "$numberLong": "2"
   309              },
   310              "autocommit": false,
   311              "readConcern": null,
   312              "startTransaction": null,
   313              "writeConcern": null
   314            },
   315            "command_name": "commitTransaction",
   316            "database_name": "admin"
   317          }
   318        },
   319        {
   320          "command_started_event": {
   321            "command": {
   322              "insert": "test",
   323              "documents": [
   324                {
   325                  "_id": 1
   326                }
   327              ],
   328              "ordered": true,
   329              "lsid": "session0",
   330              "readConcern": {
   331                "afterClusterTime": 42
   332              },
   333              "txnNumber": {
   334                "$numberLong": "3"
   335              },
   336              "startTransaction": true,
   337              "autocommit": false,
   338              "writeConcern": null
   339            },
   340            "command_name": "insert",
   341            "database_name": "withTransaction-tests"
   342          }
   343        },
   344        {
   345          "command_started_event": {
   346            "command": {
   347              "commitTransaction": 1,
   348              "lsid": "session0",
   349              "txnNumber": {
   350                "$numberLong": "3"
   351              },
   352              "autocommit": false,
   353              "readConcern": null,
   354              "startTransaction": null,
   355              "writeConcern": null
   356            },
   357            "command_name": "commitTransaction",
   358            "database_name": "admin"
   359          }
   360        }
   361      ],
   362      "outcome": {
   363        "collection": {
   364          "data": [
   365            {
   366              "_id": 1
   367            }
   368          ]
   369        }
   370      }
   371    },
   372    {
   373      "description": "transaction is retried after commitTransaction TransientTransactionError (SnapshotUnavailable)",
   374      "failPoint": {
   375        "configureFailPoint": "failCommand",
   376        "mode": {
   377          "times": 2
   378        },
   379        "data": {
   380          "failCommands": [
   381            "commitTransaction"
   382          ],
   383          "errorCode": 246,
   384          "closeConnection": false
   385        }
   386      },
   387      "operations": [
   388        {
   389          "name": "withTransaction",
   390          "object": "session0",
   391          "arguments": {
   392            "callback": {
   393              "operations": [
   394                {
   395                  "name": "insertOne",
   396                  "object": "collection",
   397                  "arguments": {
   398                    "session": "session0",
   399                    "document": {
   400                      "_id": 1
   401                    }
   402                  },
   403                  "result": {
   404                    "insertedId": 1
   405                  }
   406                }
   407              ]
   408            }
   409          }
   410        }
   411      ],
   412      "expectations": [
   413        {
   414          "command_started_event": {
   415            "command": {
   416              "insert": "test",
   417              "documents": [
   418                {
   419                  "_id": 1
   420                }
   421              ],
   422              "ordered": true,
   423              "lsid": "session0",
   424              "txnNumber": {
   425                "$numberLong": "1"
   426              },
   427              "startTransaction": true,
   428              "autocommit": false,
   429              "readConcern": null,
   430              "writeConcern": null
   431            },
   432            "command_name": "insert",
   433            "database_name": "withTransaction-tests"
   434          }
   435        },
   436        {
   437          "command_started_event": {
   438            "command": {
   439              "commitTransaction": 1,
   440              "lsid": "session0",
   441              "txnNumber": {
   442                "$numberLong": "1"
   443              },
   444              "autocommit": false,
   445              "readConcern": null,
   446              "startTransaction": null,
   447              "writeConcern": null
   448            },
   449            "command_name": "commitTransaction",
   450            "database_name": "admin"
   451          }
   452        },
   453        {
   454          "command_started_event": {
   455            "command": {
   456              "insert": "test",
   457              "documents": [
   458                {
   459                  "_id": 1
   460                }
   461              ],
   462              "ordered": true,
   463              "lsid": "session0",
   464              "readConcern": {
   465                "afterClusterTime": 42
   466              },
   467              "txnNumber": {
   468                "$numberLong": "2"
   469              },
   470              "startTransaction": true,
   471              "autocommit": false,
   472              "writeConcern": null
   473            },
   474            "command_name": "insert",
   475            "database_name": "withTransaction-tests"
   476          }
   477        },
   478        {
   479          "command_started_event": {
   480            "command": {
   481              "commitTransaction": 1,
   482              "lsid": "session0",
   483              "txnNumber": {
   484                "$numberLong": "2"
   485              },
   486              "autocommit": false,
   487              "readConcern": null,
   488              "startTransaction": null,
   489              "writeConcern": null
   490            },
   491            "command_name": "commitTransaction",
   492            "database_name": "admin"
   493          }
   494        },
   495        {
   496          "command_started_event": {
   497            "command": {
   498              "insert": "test",
   499              "documents": [
   500                {
   501                  "_id": 1
   502                }
   503              ],
   504              "ordered": true,
   505              "lsid": "session0",
   506              "readConcern": {
   507                "afterClusterTime": 42
   508              },
   509              "txnNumber": {
   510                "$numberLong": "3"
   511              },
   512              "startTransaction": true,
   513              "autocommit": false,
   514              "writeConcern": null
   515            },
   516            "command_name": "insert",
   517            "database_name": "withTransaction-tests"
   518          }
   519        },
   520        {
   521          "command_started_event": {
   522            "command": {
   523              "commitTransaction": 1,
   524              "lsid": "session0",
   525              "txnNumber": {
   526                "$numberLong": "3"
   527              },
   528              "autocommit": false,
   529              "readConcern": null,
   530              "startTransaction": null,
   531              "writeConcern": null
   532            },
   533            "command_name": "commitTransaction",
   534            "database_name": "admin"
   535          }
   536        }
   537      ],
   538      "outcome": {
   539        "collection": {
   540          "data": [
   541            {
   542              "_id": 1
   543            }
   544          ]
   545        }
   546      }
   547    },
   548    {
   549      "description": "transaction is retried after commitTransaction TransientTransactionError (NoSuchTransaction)",
   550      "failPoint": {
   551        "configureFailPoint": "failCommand",
   552        "mode": {
   553          "times": 2
   554        },
   555        "data": {
   556          "failCommands": [
   557            "commitTransaction"
   558          ],
   559          "errorCode": 251,
   560          "closeConnection": false
   561        }
   562      },
   563      "operations": [
   564        {
   565          "name": "withTransaction",
   566          "object": "session0",
   567          "arguments": {
   568            "callback": {
   569              "operations": [
   570                {
   571                  "name": "insertOne",
   572                  "object": "collection",
   573                  "arguments": {
   574                    "session": "session0",
   575                    "document": {
   576                      "_id": 1
   577                    }
   578                  },
   579                  "result": {
   580                    "insertedId": 1
   581                  }
   582                }
   583              ]
   584            }
   585          }
   586        }
   587      ],
   588      "expectations": [
   589        {
   590          "command_started_event": {
   591            "command": {
   592              "insert": "test",
   593              "documents": [
   594                {
   595                  "_id": 1
   596                }
   597              ],
   598              "ordered": true,
   599              "lsid": "session0",
   600              "txnNumber": {
   601                "$numberLong": "1"
   602              },
   603              "startTransaction": true,
   604              "autocommit": false,
   605              "readConcern": null,
   606              "writeConcern": null
   607            },
   608            "command_name": "insert",
   609            "database_name": "withTransaction-tests"
   610          }
   611        },
   612        {
   613          "command_started_event": {
   614            "command": {
   615              "commitTransaction": 1,
   616              "lsid": "session0",
   617              "txnNumber": {
   618                "$numberLong": "1"
   619              },
   620              "autocommit": false,
   621              "readConcern": null,
   622              "startTransaction": null,
   623              "writeConcern": null
   624            },
   625            "command_name": "commitTransaction",
   626            "database_name": "admin"
   627          }
   628        },
   629        {
   630          "command_started_event": {
   631            "command": {
   632              "insert": "test",
   633              "documents": [
   634                {
   635                  "_id": 1
   636                }
   637              ],
   638              "ordered": true,
   639              "lsid": "session0",
   640              "readConcern": {
   641                "afterClusterTime": 42
   642              },
   643              "txnNumber": {
   644                "$numberLong": "2"
   645              },
   646              "startTransaction": true,
   647              "autocommit": false,
   648              "writeConcern": null
   649            },
   650            "command_name": "insert",
   651            "database_name": "withTransaction-tests"
   652          }
   653        },
   654        {
   655          "command_started_event": {
   656            "command": {
   657              "commitTransaction": 1,
   658              "lsid": "session0",
   659              "txnNumber": {
   660                "$numberLong": "2"
   661              },
   662              "autocommit": false,
   663              "readConcern": null,
   664              "startTransaction": null,
   665              "writeConcern": null
   666            },
   667            "command_name": "commitTransaction",
   668            "database_name": "admin"
   669          }
   670        },
   671        {
   672          "command_started_event": {
   673            "command": {
   674              "insert": "test",
   675              "documents": [
   676                {
   677                  "_id": 1
   678                }
   679              ],
   680              "ordered": true,
   681              "lsid": "session0",
   682              "readConcern": {
   683                "afterClusterTime": 42
   684              },
   685              "txnNumber": {
   686                "$numberLong": "3"
   687              },
   688              "startTransaction": true,
   689              "autocommit": false,
   690              "writeConcern": null
   691            },
   692            "command_name": "insert",
   693            "database_name": "withTransaction-tests"
   694          }
   695        },
   696        {
   697          "command_started_event": {
   698            "command": {
   699              "commitTransaction": 1,
   700              "lsid": "session0",
   701              "txnNumber": {
   702                "$numberLong": "3"
   703              },
   704              "autocommit": false,
   705              "readConcern": null,
   706              "startTransaction": null,
   707              "writeConcern": null
   708            },
   709            "command_name": "commitTransaction",
   710            "database_name": "admin"
   711          }
   712        }
   713      ],
   714      "outcome": {
   715        "collection": {
   716          "data": [
   717            {
   718              "_id": 1
   719            }
   720          ]
   721        }
   722      }
   723    }
   724  ]
   725}

View as plain text