1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
description: mongos-unpin
schemaVersion: '1.4'
runOnRequirements:
- minServerVersion: '4.2'
topologies: [ sharded-replicaset ]
createEntities:
- client:
id: &client0 client0
useMultipleMongoses: true
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name mongos-unpin-db
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name test
- session:
id: &session0 session0
client: *client0
initialData:
- collectionName: *collection0Name
databaseName: *database0Name
documents: []
_yamlAnchors:
anchors:
# LockTimeout will cause the server to add a TransientTransactionError label. It is not retryable.
&lockTimeoutErrorCode 24
tests:
- description: unpin after TransientTransactionError error on commit
runOnRequirements:
# serverless proxy doesn't append error labels to errors in transactions
# caused by failpoints (CLOUDP-88216)
- serverless: "forbid"
operations:
- &startTransaction
name: startTransaction
object: *session0
- &insertOne
name: insertOne
object: *collection0
arguments:
document: { x: 1 }
session: *session0
- name: targetedFailPoint
object: testRunner
arguments:
session: *session0
failPoint:
configureFailPoint: failCommand
mode: { times: 1 }
data:
failCommands: [ commitTransaction ]
errorCode: *lockTimeoutErrorCode
- name: commitTransaction
object: *session0
expectError:
# LockTimeout is not retryable, so the commit fails.
errorCode: *lockTimeoutErrorCode
errorLabelsContain: [ TransientTransactionError ]
errorLabelsOmit: [ UnknownTransactionCommitResult ]
- &assertNoPinnedServer
name: assertSessionUnpinned
object: testRunner
arguments:
session: *session0
# Cleanup the potentionally open server transaction by starting and
# aborting a new transaction on the same session.
- *startTransaction
- *insertOne
- &abortTransaction
name: abortTransaction
object: *session0
- description: unpin on successful abort
operations:
- *startTransaction
- *insertOne
- *abortTransaction
- *assertNoPinnedServer
- description: unpin after non-transient error on abort
runOnRequirements:
# serverless proxy doesn't append error labels to errors in transactions
# caused by failpoints (CLOUDP-88216)
- serverless: "forbid"
operations:
- *startTransaction
- *insertOne
- name: targetedFailPoint
object: testRunner
arguments:
session: *session0
failPoint:
configureFailPoint: failCommand
mode: { times: 1 }
data:
failCommands: [ abortTransaction ]
errorCode: *lockTimeoutErrorCode
- *abortTransaction
- *assertNoPinnedServer
# Cleanup the potentionally open server transaction by starting and
# aborting a new transaction on the same session.
- *startTransaction
- *insertOne
- *abortTransaction
- description: unpin after TransientTransactionError error on abort
operations:
- *startTransaction
- *insertOne
- name: targetedFailPoint
object: testRunner
arguments:
session: *session0
failPoint:
configureFailPoint: failCommand
mode: { times: 1 }
data:
failCommands: [ abortTransaction ]
errorCode: 91 # ShutdownInProgress
- *abortTransaction
- *assertNoPinnedServer
# Cleanup the potentionally open server transaction by starting and
# aborting a new transaction on the same session.
- *startTransaction
- *insertOne
- *abortTransaction
- description: unpin when a new transaction is started
operations:
- *startTransaction
- *insertOne
- name: commitTransaction
object: *session0
- &assertPinnedServer
name: assertSessionPinned
object: testRunner
arguments:
session: *session0
- *startTransaction
- *assertNoPinnedServer
- description: unpin when a non-transaction write operation uses a session
operations:
- *startTransaction
- *insertOne
- name: commitTransaction
object: *session0
- *assertPinnedServer
- *insertOne
- *assertNoPinnedServer
- description: unpin when a non-transaction read operation uses a session
operations:
- *startTransaction
- *insertOne
- name: commitTransaction
object: *session0
- *assertPinnedServer
- name: find
object: *collection0
arguments:
filter: { x: 1 }
session: *session0
- *assertNoPinnedServer
|