Skip to content

Commit 89e8b3d

Browse files
committed
hmm undo client bulk retry changes
1 parent cc87dc3 commit 89e8b3d

File tree

2 files changed

+8
-30
lines changed

2 files changed

+8
-30
lines changed

pymongo/asynchronous/client_bulk.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -535,17 +535,10 @@ async def _execute_command(
535535
if session:
536536
# Start a new retryable write unless one was already
537537
# started for this command.
538-
if (
539-
retryable
540-
and self.is_retryable
541-
and not self.started_retryable_write
542-
and not session.in_transaction
543-
):
538+
if retryable and not self.started_retryable_write:
544539
session._start_retryable_write()
545540
self.started_retryable_write = True
546-
session._apply_to(
547-
cmd, retryable and self.is_retryable, ReadPreference.PRIMARY, conn
548-
)
541+
session._apply_to(cmd, retryable, ReadPreference.PRIMARY, conn)
549542
conn.send_cluster_time(cmd, session, self.client)
550543
conn.add_server_api(cmd)
551544
# CSOT: apply timeout before encoding the command.
@@ -572,11 +565,7 @@ async def _execute_command(
572565

573566
# Synthesize the full bulk result without modifying the
574567
# current one because this write operation may be retried.
575-
if (
576-
retryable
577-
and self.is_retryable
578-
and (retryable_top_level_error or retryable_network_error)
579-
):
568+
if retryable and (retryable_top_level_error or retryable_network_error):
580569
full = copy.deepcopy(full_result)
581570
_merge_command(self.ops, self.idx_offset, full, result)
582571
_throw_client_bulk_write_exception(full, self.verbose_results)
@@ -595,7 +584,7 @@ async def _execute_command(
595584
_merge_command(self.ops, self.idx_offset, full_result, result)
596585
break
597586

598-
if retryable and self.is_retryable:
587+
if retryable:
599588
# Retryable writeConcernErrors halt the execution of this batch.
600589
wce = result.get("writeConcernError", {})
601590
if wce.get("code", 0) in _RETRYABLE_ERROR_CODES:

pymongo/synchronous/client_bulk.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -533,17 +533,10 @@ def _execute_command(
533533
if session:
534534
# Start a new retryable write unless one was already
535535
# started for this command.
536-
if (
537-
retryable
538-
and self.is_retryable
539-
and not self.started_retryable_write
540-
and not session.in_transaction
541-
):
536+
if retryable and not self.started_retryable_write:
542537
session._start_retryable_write()
543538
self.started_retryable_write = True
544-
session._apply_to(
545-
cmd, retryable and self.is_retryable, ReadPreference.PRIMARY, conn
546-
)
539+
session._apply_to(cmd, retryable, ReadPreference.PRIMARY, conn)
547540
conn.send_cluster_time(cmd, session, self.client)
548541
conn.add_server_api(cmd)
549542
# CSOT: apply timeout before encoding the command.
@@ -570,11 +563,7 @@ def _execute_command(
570563

571564
# Synthesize the full bulk result without modifying the
572565
# current one because this write operation may be retried.
573-
if (
574-
retryable
575-
and self.is_retryable
576-
and (retryable_top_level_error or retryable_network_error)
577-
):
566+
if retryable and (retryable_top_level_error or retryable_network_error):
578567
full = copy.deepcopy(full_result)
579568
_merge_command(self.ops, self.idx_offset, full, result)
580569
_throw_client_bulk_write_exception(full, self.verbose_results)
@@ -593,7 +582,7 @@ def _execute_command(
593582
_merge_command(self.ops, self.idx_offset, full_result, result)
594583
break
595584

596-
if retryable and self.is_retryable:
585+
if retryable:
597586
# Retryable writeConcernErrors halt the execution of this batch.
598587
wce = result.get("writeConcernError", {})
599588
if wce.get("code", 0) in _RETRYABLE_ERROR_CODES:

0 commit comments

Comments
 (0)