...

Text file src/go.mongodb.org/mongo-driver/testdata/convenient-transactions/commit-writeconcernerror.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": "commitTransaction is retried after WriteConcernFailed timeout error",
    22      "failPoint": {
    23        "configureFailPoint": "failCommand",
    24        "mode": {
    25          "times": 2
    26        },
    27        "data": {
    28          "failCommands": [
    29            "commitTransaction"
    30          ],
    31          "writeConcernError": {
    32            "code": 64,
    33            "codeName": "WriteConcernFailed",
    34            "errmsg": "waiting for replication timed out",
    35            "errInfo": {
    36              "wtimeout": true
    37            }
    38          }
    39        }
    40      },
    41      "operations": [
    42        {
    43          "name": "withTransaction",
    44          "object": "session0",
    45          "arguments": {
    46            "callback": {
    47              "operations": [
    48                {
    49                  "name": "insertOne",
    50                  "object": "collection",
    51                  "arguments": {
    52                    "session": "session0",
    53                    "document": {
    54                      "_id": 1
    55                    }
    56                  },
    57                  "result": {
    58                    "insertedId": 1
    59                  }
    60                }
    61              ]
    62            }
    63          }
    64        }
    65      ],
    66      "expectations": [
    67        {
    68          "command_started_event": {
    69            "command": {
    70              "insert": "test",
    71              "documents": [
    72                {
    73                  "_id": 1
    74                }
    75              ],
    76              "ordered": true,
    77              "lsid": "session0",
    78              "txnNumber": {
    79                "$numberLong": "1"
    80              },
    81              "startTransaction": true,
    82              "autocommit": false,
    83              "readConcern": null,
    84              "writeConcern": null
    85            },
    86            "command_name": "insert",
    87            "database_name": "withTransaction-tests"
    88          }
    89        },
    90        {
    91          "command_started_event": {
    92            "command": {
    93              "commitTransaction": 1,
    94              "lsid": "session0",
    95              "txnNumber": {
    96                "$numberLong": "1"
    97              },
    98              "autocommit": false,
    99              "readConcern": null,
   100              "startTransaction": null,
   101              "writeConcern": null
   102            },
   103            "command_name": "commitTransaction",
   104            "database_name": "admin"
   105          }
   106        },
   107        {
   108          "command_started_event": {
   109            "command": {
   110              "commitTransaction": 1,
   111              "lsid": "session0",
   112              "txnNumber": {
   113                "$numberLong": "1"
   114              },
   115              "autocommit": false,
   116              "writeConcern": {
   117                "w": "majority",
   118                "wtimeout": 10000
   119              },
   120              "readConcern": null,
   121              "startTransaction": null
   122            },
   123            "command_name": "commitTransaction",
   124            "database_name": "admin"
   125          }
   126        },
   127        {
   128          "command_started_event": {
   129            "command": {
   130              "commitTransaction": 1,
   131              "lsid": "session0",
   132              "txnNumber": {
   133                "$numberLong": "1"
   134              },
   135              "autocommit": false,
   136              "writeConcern": {
   137                "w": "majority",
   138                "wtimeout": 10000
   139              },
   140              "readConcern": null,
   141              "startTransaction": null
   142            },
   143            "command_name": "commitTransaction",
   144            "database_name": "admin"
   145          }
   146        }
   147      ],
   148      "outcome": {
   149        "collection": {
   150          "data": [
   151            {
   152              "_id": 1
   153            }
   154          ]
   155        }
   156      }
   157    },
   158    {
   159      "description": "commitTransaction is retried after WriteConcernFailed non-timeout error",
   160      "failPoint": {
   161        "configureFailPoint": "failCommand",
   162        "mode": {
   163          "times": 2
   164        },
   165        "data": {
   166          "failCommands": [
   167            "commitTransaction"
   168          ],
   169          "writeConcernError": {
   170            "code": 64,
   171            "codeName": "WriteConcernFailed",
   172            "errmsg": "multiple errors reported"
   173          }
   174        }
   175      },
   176      "operations": [
   177        {
   178          "name": "withTransaction",
   179          "object": "session0",
   180          "arguments": {
   181            "callback": {
   182              "operations": [
   183                {
   184                  "name": "insertOne",
   185                  "object": "collection",
   186                  "arguments": {
   187                    "session": "session0",
   188                    "document": {
   189                      "_id": 1
   190                    }
   191                  },
   192                  "result": {
   193                    "insertedId": 1
   194                  }
   195                }
   196              ]
   197            }
   198          }
   199        }
   200      ],
   201      "expectations": [
   202        {
   203          "command_started_event": {
   204            "command": {
   205              "insert": "test",
   206              "documents": [
   207                {
   208                  "_id": 1
   209                }
   210              ],
   211              "ordered": true,
   212              "lsid": "session0",
   213              "txnNumber": {
   214                "$numberLong": "1"
   215              },
   216              "startTransaction": true,
   217              "autocommit": false,
   218              "readConcern": null,
   219              "writeConcern": null
   220            },
   221            "command_name": "insert",
   222            "database_name": "withTransaction-tests"
   223          }
   224        },
   225        {
   226          "command_started_event": {
   227            "command": {
   228              "commitTransaction": 1,
   229              "lsid": "session0",
   230              "txnNumber": {
   231                "$numberLong": "1"
   232              },
   233              "autocommit": false,
   234              "readConcern": null,
   235              "startTransaction": null,
   236              "writeConcern": 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                "wtimeout": 10000
   254              },
   255              "readConcern": null,
   256              "startTransaction": null
   257            },
   258            "command_name": "commitTransaction",
   259            "database_name": "admin"
   260          }
   261        },
   262        {
   263          "command_started_event": {
   264            "command": {
   265              "commitTransaction": 1,
   266              "lsid": "session0",
   267              "txnNumber": {
   268                "$numberLong": "1"
   269              },
   270              "autocommit": false,
   271              "writeConcern": {
   272                "w": "majority",
   273                "wtimeout": 10000
   274              },
   275              "readConcern": null,
   276              "startTransaction": null
   277            },
   278            "command_name": "commitTransaction",
   279            "database_name": "admin"
   280          }
   281        }
   282      ],
   283      "outcome": {
   284        "collection": {
   285          "data": [
   286            {
   287              "_id": 1
   288            }
   289          ]
   290        }
   291      }
   292    },
   293    {
   294      "description": "commitTransaction is not retried after UnknownReplWriteConcern error",
   295      "failPoint": {
   296        "configureFailPoint": "failCommand",
   297        "mode": {
   298          "times": 1
   299        },
   300        "data": {
   301          "failCommands": [
   302            "commitTransaction"
   303          ],
   304          "writeConcernError": {
   305            "code": 79,
   306            "codeName": "UnknownReplWriteConcern",
   307            "errmsg": "No write concern mode named 'foo' found in replica set configuration"
   308          }
   309        }
   310      },
   311      "operations": [
   312        {
   313          "name": "withTransaction",
   314          "object": "session0",
   315          "arguments": {
   316            "callback": {
   317              "operations": [
   318                {
   319                  "name": "insertOne",
   320                  "object": "collection",
   321                  "arguments": {
   322                    "session": "session0",
   323                    "document": {
   324                      "_id": 1
   325                    }
   326                  },
   327                  "result": {
   328                    "insertedId": 1
   329                  }
   330                }
   331              ]
   332            }
   333          },
   334          "result": {
   335            "errorCodeName": "UnknownReplWriteConcern",
   336            "errorLabelsOmit": [
   337              "TransientTransactionError",
   338              "UnknownTransactionCommitResult"
   339            ]
   340          }
   341        }
   342      ],
   343      "expectations": [
   344        {
   345          "command_started_event": {
   346            "command": {
   347              "insert": "test",
   348              "documents": [
   349                {
   350                  "_id": 1
   351                }
   352              ],
   353              "ordered": true,
   354              "lsid": "session0",
   355              "txnNumber": {
   356                "$numberLong": "1"
   357              },
   358              "startTransaction": true,
   359              "autocommit": false,
   360              "readConcern": null,
   361              "writeConcern": null
   362            },
   363            "command_name": "insert",
   364            "database_name": "withTransaction-tests"
   365          }
   366        },
   367        {
   368          "command_started_event": {
   369            "command": {
   370              "commitTransaction": 1,
   371              "lsid": "session0",
   372              "txnNumber": {
   373                "$numberLong": "1"
   374              },
   375              "autocommit": false,
   376              "readConcern": null,
   377              "startTransaction": null,
   378              "writeConcern": null
   379            },
   380            "command_name": "commitTransaction",
   381            "database_name": "admin"
   382          }
   383        }
   384      ],
   385      "outcome": {
   386        "collection": {
   387          "data": [
   388            {
   389              "_id": 1
   390            }
   391          ]
   392        }
   393      }
   394    },
   395    {
   396      "description": "commitTransaction is not retried after UnsatisfiableWriteConcern error",
   397      "failPoint": {
   398        "configureFailPoint": "failCommand",
   399        "mode": {
   400          "times": 1
   401        },
   402        "data": {
   403          "failCommands": [
   404            "commitTransaction"
   405          ],
   406          "writeConcernError": {
   407            "code": 100,
   408            "codeName": "UnsatisfiableWriteConcern",
   409            "errmsg": "Not enough data-bearing nodes"
   410          }
   411        }
   412      },
   413      "operations": [
   414        {
   415          "name": "withTransaction",
   416          "object": "session0",
   417          "arguments": {
   418            "callback": {
   419              "operations": [
   420                {
   421                  "name": "insertOne",
   422                  "object": "collection",
   423                  "arguments": {
   424                    "session": "session0",
   425                    "document": {
   426                      "_id": 1
   427                    }
   428                  },
   429                  "result": {
   430                    "insertedId": 1
   431                  }
   432                }
   433              ]
   434            }
   435          },
   436          "result": {
   437            "errorCodeName": "UnsatisfiableWriteConcern",
   438            "errorLabelsOmit": [
   439              "TransientTransactionError",
   440              "UnknownTransactionCommitResult"
   441            ]
   442          }
   443        }
   444      ],
   445      "expectations": [
   446        {
   447          "command_started_event": {
   448            "command": {
   449              "insert": "test",
   450              "documents": [
   451                {
   452                  "_id": 1
   453                }
   454              ],
   455              "ordered": true,
   456              "lsid": "session0",
   457              "txnNumber": {
   458                "$numberLong": "1"
   459              },
   460              "startTransaction": true,
   461              "autocommit": false,
   462              "readConcern": null,
   463              "writeConcern": null
   464            },
   465            "command_name": "insert",
   466            "database_name": "withTransaction-tests"
   467          }
   468        },
   469        {
   470          "command_started_event": {
   471            "command": {
   472              "commitTransaction": 1,
   473              "lsid": "session0",
   474              "txnNumber": {
   475                "$numberLong": "1"
   476              },
   477              "autocommit": false,
   478              "readConcern": null,
   479              "startTransaction": null,
   480              "writeConcern": null
   481            },
   482            "command_name": "commitTransaction",
   483            "database_name": "admin"
   484          }
   485        }
   486      ],
   487      "outcome": {
   488        "collection": {
   489          "data": [
   490            {
   491              "_id": 1
   492            }
   493          ]
   494        }
   495      }
   496    },
   497    {
   498      "description": "commitTransaction is not retried after MaxTimeMSExpired error",
   499      "failPoint": {
   500        "configureFailPoint": "failCommand",
   501        "mode": {
   502          "times": 1
   503        },
   504        "data": {
   505          "failCommands": [
   506            "commitTransaction"
   507          ],
   508          "writeConcernError": {
   509            "code": 50,
   510            "codeName": "MaxTimeMSExpired",
   511            "errmsg": "operation exceeded time limit"
   512          }
   513        }
   514      },
   515      "operations": [
   516        {
   517          "name": "withTransaction",
   518          "object": "session0",
   519          "arguments": {
   520            "callback": {
   521              "operations": [
   522                {
   523                  "name": "insertOne",
   524                  "object": "collection",
   525                  "arguments": {
   526                    "session": "session0",
   527                    "document": {
   528                      "_id": 1
   529                    }
   530                  },
   531                  "result": {
   532                    "insertedId": 1
   533                  }
   534                }
   535              ]
   536            }
   537          },
   538          "result": {
   539            "errorCodeName": "MaxTimeMSExpired",
   540            "errorLabelsContain": [
   541              "UnknownTransactionCommitResult"
   542            ],
   543            "errorLabelsOmit": [
   544              "TransientTransactionError"
   545            ]
   546          }
   547        }
   548      ],
   549      "expectations": [
   550        {
   551          "command_started_event": {
   552            "command": {
   553              "insert": "test",
   554              "documents": [
   555                {
   556                  "_id": 1
   557                }
   558              ],
   559              "ordered": true,
   560              "lsid": "session0",
   561              "txnNumber": {
   562                "$numberLong": "1"
   563              },
   564              "startTransaction": true,
   565              "autocommit": false,
   566              "readConcern": null,
   567              "writeConcern": null
   568            },
   569            "command_name": "insert",
   570            "database_name": "withTransaction-tests"
   571          }
   572        },
   573        {
   574          "command_started_event": {
   575            "command": {
   576              "commitTransaction": 1,
   577              "lsid": "session0",
   578              "txnNumber": {
   579                "$numberLong": "1"
   580              },
   581              "autocommit": false,
   582              "readConcern": null,
   583              "startTransaction": null,
   584              "writeConcern": null
   585            },
   586            "command_name": "commitTransaction",
   587            "database_name": "admin"
   588          }
   589        }
   590      ],
   591      "outcome": {
   592        "collection": {
   593          "data": [
   594            {
   595              "_id": 1
   596            }
   597          ]
   598        }
   599      }
   600    }
   601  ]
   602}

View as plain text