| 1 | runOn: |
| 2 | - |
| 3 | minServerVersion: "4.0" |
| 4 | topology: ["replicaset"] |
| 5 | - |
| 6 | minServerVersion: "4.1.7" |
| 7 | topology: ["sharded", "load-balanced"] |
| 8 | |
| 9 | data: |
| 10 | - { _id: 1, x: 11 } |
| 11 | - { _id: 2, x: 22 } |
| 12 | |
| 13 | tests: |
| 14 | - |
| 15 | description: "ReplaceOne succeeds after PrimarySteppedDown" |
| 16 | failPoint: |
| 17 | configureFailPoint: failCommand |
| 18 | mode: { times: 1 } |
| 19 | data: |
| 20 | failCommands: ["update"] |
| 21 | errorCode: 189 |
| 22 | errorLabels: ["RetryableWriteError"] |
| 23 | operation: |
| 24 | name: "replaceOne" |
| 25 | arguments: |
| 26 | filter: { _id: 1 } |
| 27 | replacement: { _id: 1, x: 111 } |
| 28 | outcome: |
| 29 | result: |
| 30 | matchedCount: 1 |
| 31 | modifiedCount: 1 |
| 32 | upsertedCount: 0 |
| 33 | collection: |
| 34 | data: |
| 35 | - { _id: 1, x: 111 } |
| 36 | - { _id: 2, x: 22 } |
| 37 | - |
| 38 | description: "ReplaceOne succeeds after WriteConcernError ShutdownInProgress" |
| 39 | failPoint: |
| 40 | configureFailPoint: failCommand |
| 41 | mode: { times: 1 } |
| 42 | data: |
| 43 | failCommands: ["update"] |
| 44 | writeConcernError: |
| 45 | code: 91 |
| 46 | errmsg: Replication is being shut down |
| 47 | errorLabels: ["RetryableWriteError"] |
| 48 | operation: |
| 49 | name: "replaceOne" |
| 50 | arguments: |
| 51 | filter: { _id: 1 } |
| 52 | replacement: { _id: 1, x: 111 } |
| 53 | outcome: |
| 54 | result: |
| 55 | matchedCount: 1 |
| 56 | modifiedCount: 1 |
| 57 | upsertedCount: 0 |
| 58 | collection: |
| 59 | data: |
| 60 | - { _id: 1, x: 111 } |
| 61 | - { _id: 2, x: 22 } |
| 62 | - |
| 63 | description: "ReplaceOne fails with a RetryableWriteError label after two connection failures" |
| 64 | failPoint: |
| 65 | configureFailPoint: failCommand |
| 66 | mode: { times: 2 } |
| 67 | data: |
| 68 | failCommands: ["update"] |
| 69 | closeConnection: true |
| 70 | operation: |
| 71 | name: "replaceOne" |
| 72 | arguments: |
| 73 | filter: { _id: 1 } |
| 74 | replacement: { _id: 1, x: 111 } |
| 75 | outcome: |
| 76 | error: true |
| 77 | result: |
| 78 | errorLabelsContain: ["RetryableWriteError"] |
| 79 | collection: |
| 80 | data: |
| 81 | - { _id: 1, x: 11 } |
| 82 | - { _id: 2, x: 22 } |