PYTHON-4924 - PoolClearedError should have TransientTransactionError …#2244
PYTHON-4924 - PoolClearedError should have TransientTransactionError …#2244NoahStapp merged 3 commits intomongodb:masterfrom
Conversation
…label appended to it
pymongo/asynchronous/pool.py
Outdated
| ) -> NoReturn: | ||
| """Convert a socket.error to ConnectionFailure and raise it.""" | ||
| host, port = address | ||
| if isinstance(error, PyMongoError) and error._error_labels: |
There was a problem hiding this comment.
I don't think we need any pymongo changes here. We already add the error label to PoolClearedErrors here:
There was a problem hiding this comment.
Would we expect the added test to still pass without the code changes then? It fails without these changes.
There was a problem hiding this comment.
That test should fail because we only add the TransientTransactionError if we're actually running a transaction.
There was a problem hiding this comment.
Got it, got it. We can go ahead and close this PR and ticket it sounds like then.
There was a problem hiding this comment.
Can you confirm that we have a test for "pool clear error" having the label in a txn? If not we should add one.
There was a problem hiding this comment.
Our Start Transactions Retry Example 1 section of TestTransactionExamples in test_examples.py refers to the label, but I don't think it is intended to fail every time and check for the label:
mongo-python-driver/test/asynchronous/test_examples.py
Lines 1007 to 1021 in 58a41ae
There was a problem hiding this comment.
We still need that new tests added in this PR.
pymongo/asynchronous/pool.py
Outdated
| ) -> NoReturn: | ||
| """Convert a socket.error to ConnectionFailure and raise it.""" | ||
| host, port = address | ||
| if isinstance(error, PyMongoError) and error._error_labels: |
There was a problem hiding this comment.
We still need that new tests added in this PR.
…label appended to it