Skip to content

Commit 2a7472a

Browse files
committed
update test names and fix writeconcern handling
1 parent cda4ff7 commit 2a7472a

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

pymongo/asynchronous/mongo_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2824,8 +2824,10 @@ async def run(self) -> T:
28242824
and self._session is not None
28252825
and self._session.in_transaction
28262826
):
2827-
if not self._session._transaction.has_completed_command:
2828-
self._session._transaction.set_starting()
2827+
transaction = self._session._transaction
2828+
if not transaction.has_completed_command:
2829+
transaction.set_starting()
2830+
transaction.attempt = 0
28292831
else:
28302832
raise
28312833

@@ -2864,8 +2866,10 @@ async def run(self) -> T:
28642866
# Revert back to starting state if we're in a transaction but haven't completed the first
28652867
# command.
28662868
if overloaded and self._session is not None and self._session.in_transaction:
2867-
if not self._session._transaction.has_completed_command:
2868-
self._session._transaction.set_starting()
2869+
transaction = self._session._transaction
2870+
if not transaction.has_completed_command:
2871+
transaction.set_starting()
2872+
transaction.attempt = 0
28692873

28702874
if self._client.topology_description.topology_type == TOPOLOGY_TYPE.Sharded:
28712875
self._deprioritized_servers.append(self._server)

pymongo/synchronous/mongo_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,8 +2814,10 @@ def run(self) -> T:
28142814
and self._session is not None
28152815
and self._session.in_transaction
28162816
):
2817-
if not self._session._transaction.has_completed_command:
2818-
self._session._transaction.set_starting()
2817+
transaction = self._session._transaction
2818+
if not transaction.has_completed_command:
2819+
transaction.set_starting()
2820+
transaction.attempt = 0
28192821
else:
28202822
raise
28212823

@@ -2854,8 +2856,10 @@ def run(self) -> T:
28542856
# Revert back to starting state if we're in a transaction but haven't completed the first
28552857
# command.
28562858
if overloaded and self._session is not None and self._session.in_transaction:
2857-
if not self._session._transaction.has_completed_command:
2858-
self._session._transaction.set_starting()
2859+
transaction = self._session._transaction
2860+
if not transaction.has_completed_command:
2861+
transaction.set_starting()
2862+
transaction.attempt = 0
28592863

28602864
if self._client.topology_description.topology_type == TOPOLOGY_TYPE.Sharded:
28612865
self._deprioritized_servers.append(self._server)

test/transactions/unified/backpressure-retryable-abort.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "retryable-abort",
2+
"description": "backpressure-retryable-abort",
33
"schemaVersion": "1.3",
44
"runOnRequirements": [
55
{

test/transactions/unified/backpressure-retryable-commit.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "retryable-commit",
2+
"description": "backpressure-retryable-commit",
33
"schemaVersion": "1.4",
44
"runOnRequirements": [
55
{
@@ -177,8 +177,7 @@
177177
},
178178
"autocommit": false,
179179
"writeConcern": {
180-
"w": "majority",
181-
"wtimeout": 10000
180+
"$$exists": false
182181
}
183182
},
184183
"commandName": "commitTransaction",
@@ -200,8 +199,7 @@
200199
},
201200
"autocommit": false,
202201
"writeConcern": {
203-
"w": "majority",
204-
"wtimeout": 10000
202+
"$$exists": false
205203
}
206204
},
207205
"commandName": "commitTransaction",

0 commit comments

Comments
 (0)