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

client.bulk_write does not handle $clusterTime from error responses

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.9
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      From my reading of client.bulk_write, it does not handle $clusterTime from error responses:

              result = await self.write_command(
                  bwc, cmd, request_id, msg, to_send_ops, to_send_ns, self.client
              )  # type: ignore[arg-type]
              await self.client._process_response(result, bwc.session)  # type: ignore[arg-type]
              return result, to_send_ops, to_send_ns  # type: ignore[return-value]
      

      On error, write_command() returns this form:

                  # Top-level error will be embedded in ClientBulkWriteException.
                  reply = {"error": exc}
      

      So _process_response can't get the $clusterTime of the error.

      This problem might not be unique to bulk_write. We should investigate if insert_one/find/coll.bulk_write have the same bug.

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: