| 1 |
description: "poc-transactions-mongos-pin-auto" |
| 2 |
|
| 3 |
schemaVersion: "1.0" |
| 4 |
|
| 5 |
runOnRequirements: |
| 6 |
- minServerVersion: "4.1.8" |
| 7 |
topologies: [ sharded-replicaset ] |
| 8 |
|
| 9 |
createEntities: |
| 10 |
- client: |
| 11 |
id: &client0 client0 |
| 12 |
useMultipleMongoses: true |
| 13 |
observeEvents: [ commandStartedEvent ] |
| 14 |
- database: |
| 15 |
id: &database0 database0 |
| 16 |
client: *client0 |
| 17 |
databaseName: &database0Name transaction-tests |
| 18 |
- collection: |
| 19 |
id: &collection0 collection0 |
| 20 |
database: *database0 |
| 21 |
collectionName: &collection0Name test |
| 22 |
- session: |
| 23 |
id: &session0 session0 |
| 24 |
client: *client0 |
| 25 |
|
| 26 |
initialData: |
| 27 |
- collectionName: *collection0Name |
| 28 |
databaseName: *database0Name |
| 29 |
documents: |
| 30 |
- { _id: 1 } |
| 31 |
- { _id: 2 } |
| 32 |
|
| 33 |
tests: |
| 34 |
- description: "remain pinned after non-transient Interrupted error on insertOne" |
| 35 |
operations: |
| 36 |
- &startTransaction |
| 37 |
name: startTransaction |
| 38 |
object: *session0 |
| 39 |
- &firstInsert |
| 40 |
name: insertOne |
| 41 |
object: *collection0 |
| 42 |
arguments: |
| 43 |
session: *session0 |
| 44 |
document: { _id: 3 } |
| 45 |
expectResult: { $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 3 } } } |
| 46 |
- name: targetedFailPoint |
| 47 |
object: testRunner |
| 48 |
arguments: |
| 49 |
session: *session0 |
| 50 |
failPoint: |
| 51 |
configureFailPoint: failCommand |
| 52 |
mode: { times: 1 } |
| 53 |
data: |
| 54 |
failCommands: [ insert ] |
| 55 |
errorCode: 11601 |
| 56 |
- name: insertOne |
| 57 |
object: *collection0 |
| 58 |
arguments: |
| 59 |
session: *session0 |
| 60 |
document: { _id: 4 } |
| 61 |
expectError: |
| 62 |
errorLabelsOmit: [ TransientTransactionError, UnknownTransactionCommitResult ] |
| 63 |
errorCodeName: Interrupted |
| 64 |
- name: assertSessionPinned |
| 65 |
object: testRunner |
| 66 |
arguments: |
| 67 |
session: *session0 |
| 68 |
- name: commitTransaction |
| 69 |
object: *session0 |
| 70 |
expectEvents: |
| 71 |
- client: *client0 |
| 72 |
events: |
| 73 |
- commandStartedEvent: &firstInsertEvent |
| 74 |
command: |
| 75 |
insert: *collection0Name |
| 76 |
documents: [ { _id: 3 } ] |
| 77 |
ordered: true |
| 78 |
readConcern: { $$exists: false } |
| 79 |
lsid: { $$sessionLsid: *session0 } |
| 80 |
txnNumber: 1 |
| 81 |
startTransaction: true |
| 82 |
autocommit: false |
| 83 |
writeConcern: { $$exists: false } |
| 84 |
commandName: insert |
| 85 |
databaseName: *database0Name |
| 86 |
- commandStartedEvent: &secondInsertEvent |
| 87 |
command: |
| 88 |
insert: *collection0Name |
| 89 |
documents: [ { _id: 4 } ] |
| 90 |
ordered: true |
| 91 |
readConcern: { $$exists: false } |
| 92 |
lsid: { $$sessionLsid: *session0 } |
| 93 |
txnNumber: 1 |
| 94 |
startTransaction: { $$exists: false } |
| 95 |
autocommit: false |
| 96 |
writeConcern: { $$exists: false } |
| 97 |
commandName: insert |
| 98 |
databaseName: *database0Name |
| 99 |
- commandStartedEvent: |
| 100 |
command: |
| 101 |
commitTransaction: 1 |
| 102 |
lsid: { $$sessionLsid: *session0 } |
| 103 |
txnNumber: 1 |
| 104 |
startTransaction: { $$exists: false } |
| 105 |
autocommit: false |
| 106 |
writeConcern: { $$exists: false } |
| 107 |
|
| 108 |
recoveryToken: { $$type: object } |
| 109 |
commandName: commitTransaction |
| 110 |
databaseName: admin |
| 111 |
outcome: |
| 112 |
- collectionName: *collection0Name |
| 113 |
databaseName: *database0Name |
| 114 |
documents: |
| 115 |
- { _id: 1 } |
| 116 |
- { _id: 2 } |
| 117 |
- { _id: 3 } |
| 118 |
|
| 119 |
- description: "unpin after transient error within a transaction" |
| 120 |
operations: |
| 121 |
- *startTransaction |
| 122 |
- *firstInsert |
| 123 |
- name: targetedFailPoint |
| 124 |
object: testRunner |
| 125 |
arguments: |
| 126 |
session: *session0 |
| 127 |
failPoint: |
| 128 |
configureFailPoint: failCommand |
| 129 |
mode: { times: 1 } |
| 130 |
data: |
| 131 |
failCommands: [ insert ] |
| 132 |
closeConnection: true |
| 133 |
- name: insertOne |
| 134 |
object: *collection0 |
| 135 |
arguments: |
| 136 |
session: *session0 |
| 137 |
document: { _id: 4 } |
| 138 |
expectError: |
| 139 |
errorLabelsContain: [ TransientTransactionError ] |
| 140 |
errorLabelsOmit: [ UnknownTransactionCommitResult ] |
| 141 |
- name: assertSessionUnpinned |
| 142 |
object: testRunner |
| 143 |
arguments: |
| 144 |
session: *session0 |
| 145 |
- name: abortTransaction |
| 146 |
object: *session0 |
| 147 |
expectEvents: |
| 148 |
- client: *client0 |
| 149 |
events: |
| 150 |
- commandStartedEvent: *firstInsertEvent |
| 151 |
- commandStartedEvent: *secondInsertEvent |
| 152 |
- commandStartedEvent: |
| 153 |
command: |
| 154 |
abortTransaction: 1 |
| 155 |
lsid: { $$sessionLsid: *session0 } |
| 156 |
txnNumber: 1 |
| 157 |
startTransaction: { $$exists: false } |
| 158 |
autocommit: false |
| 159 |
writeConcern: { $$exists: false } |
| 160 |
|
| 161 |
recoveryToken: { $$type: object } |
| 162 |
commandName: abortTransaction |
| 163 |
databaseName: admin |
| 164 |
outcome: |
| 165 |
- collectionName: *collection0Name |
| 166 |
databaseName: *database0Name |
| 167 |
documents: |
| 168 |
- { _id: 1 } |
| 169 |
- { _id: 2 } |