...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy/insertOne-serverErrors.yml

Documentation: go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy

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

View as plain text