Skip to content

DRIVERS-1815 Clarify PoolClearedError labels #1804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions source/transactions/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,29 @@ driver, use command monitoring instead.

## PoolClearedError Prose Test

Test that `PoolClearedError` has `TransientTransactionError` label. Since there is no simple way to trigger
`PoolClearedError`, this test should be implemented in a way that suites each driver the best.
### PoolClearedError has TransientTransactionError label when raised while not committing a transaction.

- Create a MongoClient running against a sharded cluster with a single mongos or a replica set with a single mongod
- transactions require a 4.0+ server when non-sharded and 4.2+ when sharded
- Start a new session on the client.
- Start a transaction on the session.
- Obtain a connection pool for the mongos or mongod.
- Set pool to the paused state.
- Attempt to check out a connection from the pool.
- Ensure that a `PoolClearedError` is raised.
- Ensure that the `PoolClearedError` has the `TransientTransactionError` label.

### PoolClearedError does not have TransientTransactionError label when raised while committing a transaction.

- Create a MongoClient running against a sharded cluster with a single mongos or a replica set with a single mongod
- transactions require a 4.0+ server when non-sharded and 4.2+ when sharded
- Start a new session on the client.
- Start a transaction on the session.
- Obtain a connection pool for the mongos or mongod.
- Set pool to the paused state.
- Attempt to commit the transaction.
- Ensure that a `PoolClearedError` is raised.
- Ensure that the `PoolClearedError` does not have the `TransientTransactionError` label.

## Options Inside Transaction Prose Tests.

Expand Down
17 changes: 8 additions & 9 deletions source/transactions/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ string error labels. Drivers may also add error labels to errors that they retur

#### Transient Transaction Error

Any command, network, or driver error that includes the "TransientTransactionError" error label in the "errorLabels"
field.
Any command or network error (including "PoolClearedError") that includes the "TransientTransactionError" error label in
the "errorLabels" field.

### **Naming variations**

Expand Down Expand Up @@ -688,13 +688,12 @@ string error labels.

### Transient Transaction Error

- Any command error that includes the "TransientTransactionError" error label in the "errorLabels" field. In the case of
command errors, the server adds the label.
- Any network error or server selection error encountered running any command besides commitTransaction in a
transaction. In the case of network errors or server selection errors where the client receives no server reply, the
client MUST add the label. If a network error occurs while running the commitTransaction command then it is not
known whether the transaction committed or not, and thus the "TransientTransactionError" label MUST NOT be added.
- `PoolClearedError`. Driver MUST add the label to this error.
Any command error that includes the "TransientTransactionError" error label in the "errorLabels" field. Any network
error (including "PoolClearedError") or server selection error encountered running any command besides commitTransaction
in a transaction. In the case of command errors, the server adds the label; in the case of network errors or server
selection errors where the client receives no server reply, the client MUST add the label. If a network error occurs
while running the commitTransaction command then it is not known whether the transaction committed or not, and thus the
"TransientTransactionError" label MUST NOT be added.

#### Retrying transactions that fail with TransientTransactionError

Expand Down
Loading