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

Multiple startTransaction: true for simultaneous operations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.7.2
    • Fix Version/s: None
    • Component/s: Transactions
    • Labels:
      None
    • Environment:
      Windows 10

      Description

      When we need to use code like this:

      var userId = @event.UserId;
       
      await Task.WhenAll(
       CreateInitialSettings(userId),
       CreateWidgets(userId),
       CreatePersonalGroup(userId),
       CreateIncomingMessage(userId)
      ); 
      

      causes error: Cannot specify 'startTransaction' on transaction 1 since it is already in progress.

      All this operations go to Mongo with startTransaction: true argument, but only first operation must use this option.

      This very strange behaviour in Server API and looks like crutch. (as it looks now)

      Why we use session.StartTransaction() and operations must known about transaction ? Why this logic leaked from sessions to operations?

      This bug is not driver bug, but you need to fix it on your side.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: