Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-5449

Retry does not work with BulkWrite operations within the session

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 3.2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Dotnet Drivers
    • Not Needed

      The BulkWrite command throws a ClientBulkWriteException when there is a conflict issue. However, this exception does not include the TransientTransactionError label, which is only present in the InnerException.

      As a result, the session.WithTransactionAsync method does not automatically retry the operation, as it should.

      Steps to Reproduce:

      1. Execute a BulkWrite operation inside a session.WithTransactionAsync block.
      2. Introduce a transient conflict error (e.g., a write conflict).
      3. Observe that the operation fails without retrying, even though retries are expected in this scenario.

      Expected Behavior:
      The ClientBulkWriteException should include the TransientTransactionError label to ensure session.WithTransactionAsync retries the operation as intended.

      Actual Behavior:
      The TransientTransactionError label is present only in the InnerException, and the session.WithTransactionAsync method does not retry the operation.

       

      Created from community post: https://www.mongodb.com/community/forums/t/retry-does-not-work-with-bulkwrite-operations-within-the-session/308012

            Assignee:
            oleksandr.poliakov@mongodb.com Oleksandr Poliakov
            Reporter:
            oleksandr.poliakov@mongodb.com Oleksandr Poliakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: