| 1 | { |
| 2 | "runOn": [ |
| 3 | { |
| 4 | "minServerVersion": "3.6", |
| 5 | "topology": [ |
| 6 | "replicaset" |
| 7 | ] |
| 8 | } |
| 9 | ], |
| 10 | "data": [ |
| 11 | { |
| 12 | "_id": 1, |
| 13 | "x": 11 |
| 14 | }, |
| 15 | { |
| 16 | "_id": 2, |
| 17 | "x": 22 |
| 18 | } |
| 19 | ], |
| 20 | "tests": [ |
| 21 | { |
| 22 | "description": "FindOneAndReplace is committed on first attempt", |
| 23 | "failPoint": { |
| 24 | "configureFailPoint": "onPrimaryTransactionalWrite", |
| 25 | "mode": { |
| 26 | "times": 1 |
| 27 | } |
| 28 | }, |
| 29 | "operation": { |
| 30 | "name": "findOneAndReplace", |
| 31 | "arguments": { |
| 32 | "filter": { |
| 33 | "_id": 1 |
| 34 | }, |
| 35 | "replacement": { |
| 36 | "_id": 1, |
| 37 | "x": 111 |
| 38 | }, |
| 39 | "returnDocument": "Before" |
| 40 | } |
| 41 | }, |
| 42 | "outcome": { |
| 43 | "result": { |
| 44 | "_id": 1, |
| 45 | "x": 11 |
| 46 | }, |
| 47 | "collection": { |
| 48 | "data": [ |
| 49 | { |
| 50 | "_id": 1, |
| 51 | "x": 111 |
| 52 | }, |
| 53 | { |
| 54 | "_id": 2, |
| 55 | "x": 22 |
| 56 | } |
| 57 | ] |
| 58 | } |
| 59 | } |
| 60 | }, |
| 61 | { |
| 62 | "description": "FindOneAndReplace is not committed on first attempt", |
| 63 | "failPoint": { |
| 64 | "configureFailPoint": "onPrimaryTransactionalWrite", |
| 65 | "mode": { |
| 66 | "times": 1 |
| 67 | }, |
| 68 | "data": { |
| 69 | "failBeforeCommitExceptionCode": 1 |
| 70 | } |
| 71 | }, |
| 72 | "operation": { |
| 73 | "name": "findOneAndReplace", |
| 74 | "arguments": { |
| 75 | "filter": { |
| 76 | "_id": 1 |
| 77 | }, |
| 78 | "replacement": { |
| 79 | "_id": 1, |
| 80 | "x": 111 |
| 81 | }, |
| 82 | "returnDocument": "Before" |
| 83 | } |
| 84 | }, |
| 85 | "outcome": { |
| 86 | "result": { |
| 87 | "_id": 1, |
| 88 | "x": 11 |
| 89 | }, |
| 90 | "collection": { |
| 91 | "data": [ |
| 92 | { |
| 93 | "_id": 1, |
| 94 | "x": 111 |
| 95 | }, |
| 96 | { |
| 97 | "_id": 2, |
| 98 | "x": 22 |
| 99 | } |
| 100 | ] |
| 101 | } |
| 102 | } |
| 103 | }, |
| 104 | { |
| 105 | "description": "FindOneAndReplace is never committed", |
| 106 | "failPoint": { |
| 107 | "configureFailPoint": "onPrimaryTransactionalWrite", |
| 108 | "mode": { |
| 109 | "times": 2 |
| 110 | }, |
| 111 | "data": { |
| 112 | "failBeforeCommitExceptionCode": 1 |
| 113 | } |
| 114 | }, |
| 115 | "operation": { |
| 116 | "name": "findOneAndReplace", |
| 117 | "arguments": { |
| 118 | "filter": { |
| 119 | "_id": 1 |
| 120 | }, |
| 121 | "replacement": { |
| 122 | "_id": 1, |
| 123 | "x": 111 |
| 124 | }, |
| 125 | "returnDocument": "Before" |
| 126 | } |
| 127 | }, |
| 128 | "outcome": { |
| 129 | "error": true, |
| 130 | "collection": { |
| 131 | "data": [ |
| 132 | { |
| 133 | "_id": 1, |
| 134 | "x": 11 |
| 135 | }, |
| 136 | { |
| 137 | "_id": 2, |
| 138 | "x": 22 |
| 139 | } |
| 140 | ] |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | ] |
| 145 | } |