| 1 | runOn: |
| 2 | - |
| 3 | minServerVersion: "3.6" |
| 4 | topology: ["replicaset"] |
| 5 | |
| 6 | data: |
| 7 | - { _id: 1, x: 11 } |
| 8 | - { _id: 2, x: 22 } |
| 9 | |
| 10 | tests: |
| 11 | - |
| 12 | description: "ReplaceOne is committed on first attempt" |
| 13 | failPoint: |
| 14 | configureFailPoint: onPrimaryTransactionalWrite |
| 15 | mode: { times: 1 } |
| 16 | operation: |
| 17 | name: "replaceOne" |
| 18 | arguments: |
| 19 | filter: { _id: 1 } |
| 20 | replacement: { _id: 1, x: 111 } |
| 21 | outcome: |
| 22 | result: |
| 23 | matchedCount: 1 |
| 24 | modifiedCount: 1 |
| 25 | upsertedCount: 0 |
| 26 | collection: |
| 27 | data: |
| 28 | - { _id: 1, x: 111 } |
| 29 | - { _id: 2, x: 22 } |
| 30 | - |
| 31 | description: "ReplaceOne is not committed on first attempt" |
| 32 | failPoint: |
| 33 | configureFailPoint: onPrimaryTransactionalWrite |
| 34 | mode: { times: 1 } |
| 35 | data: { failBeforeCommitExceptionCode: 1 } |
| 36 | operation: |
| 37 | name: "replaceOne" |
| 38 | arguments: |
| 39 | filter: { _id: 1 } |
| 40 | replacement: { _id: 1, x: 111 } |
| 41 | outcome: |
| 42 | result: |
| 43 | matchedCount: 1 |
| 44 | modifiedCount: 1 |
| 45 | upsertedCount: 0 |
| 46 | collection: |
| 47 | data: |
| 48 | - { _id: 1, x: 111 } |
| 49 | - { _id: 2, x: 22 } |
| 50 | - |
| 51 | description: "ReplaceOne is never committed" |
| 52 | failPoint: |
| 53 | configureFailPoint: onPrimaryTransactionalWrite |
| 54 | mode: { times: 2 } |
| 55 | data: { failBeforeCommitExceptionCode: 1 } |
| 56 | operation: |
| 57 | name: "replaceOne" |
| 58 | arguments: |
| 59 | filter: { _id: 1 } |
| 60 | replacement: { _id: 1, x: 111 } |
| 61 | outcome: |
| 62 | error: true |
| 63 | collection: |
| 64 | data: |
| 65 | - { _id: 1, x: 11 } |
| 66 | - { _id: 2, x: 22 } |