Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1857

Bulk operations are marked as 'executed' even on operation failures

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.8
    • Component/s: Query Operations, Write Ops
    • None

      Currently, when a pymongo.bulk._Bulk operation executes, it is marked as 'executed' before dispatching the actual command.

      This means that if the command would fail with, say, an OperationalFailure - and would be manually retried by the users, an: InvalidOperation('Bulk operations can only be executed once.') exception will be raised.

       

      If that was not the intentional behavior, I think we could either:

      1. Decide that it is, in fact, the desired behavior - and document it
      2. Mark the operation as executed only on successful invocations
      3. Mark the operation as executed on successful invocations, and on timeout errors, where we can't determine whether the operation had took place or not

       

      Would love to hear your suggestions and thoughts.

       

      Thanks !

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            dashemes Danny Shemesh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: