Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-2218

Clarify intended bounding of implicit session allocation and rework flaky prose test

    • Type: Icon: Spec Change Spec Change
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Component/s: Sessions
    • Needed
    • Hide

      Review the updated clarification for spec test 13 and ensure your driver is aligned with the test's assertion requirements. 

      Show
      Review the updated clarification for spec test 13 and ensure your driver is aligned with the test's assertion requirements. 
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      CDRIVER-4311 Works as Designed
      CXX-2465 Works as Designed
      CSHARP-4097 Done 2.16.0
      GODRIVER-2332 Duplicate
      JAVA-4531 Fixed 4.6.0
      NODE-4082 Done 4.6.0
      MOTOR-909 Duplicate
      PYTHON-3169 Duplicate
      PHPLIB-811 Won't Do
      RUBY-2924 Fixed 2.18.0
      RUST-1218 Duplicate
      SWIFT-1516 Won't Fix
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion CDRIVER-4311 Works as Designed CXX-2465 Works as Designed CSHARP-4097 Done 2.16.0 GODRIVER-2332 Duplicate JAVA-4531 Fixed 4.6.0 NODE-4082 Done 4.6.0 MOTOR-909 Duplicate PYTHON-3169 Duplicate PHPLIB-811 Won't Do RUBY-2924 Fixed 2.18.0 RUST-1218 Duplicate SWIFT-1516 Won't Fix

      The prose test added in DRIVERS-1030 is flakey:

      13. To confirm that implicit sessions only allocate their server session after a successful connection checkout
      
          * Create a MongoClient with the following options: ``maxPoolSize=1`` and ``retryWrites=true``
          * Attach a command started listener that collects each command's lsid
          * Initiate the following concurrent operations
            * insertOne
            * deleteOne
            * updateOne
            * bulkWrite ``[ { updateOne } ]``
            * findOneAndDelete
            * findOneAndUpdate
            * findOneAndReplace
            * find
          * Wait for all operations to complete
          * Assert that all commands contain the same lsid
      

      The issue is that the session is checked back into the pool after the connection is checked back in. So there's always the risk that this test uses >1 server session. The only way to guarantee this test is to also optimize implicit session deallocation as well. However, that is potentially trickier since we would need to ensure that retryable reads/writes, cursors, and other pinned operations don't deallocate the session too early.

      Acceptance Criteria

      • Change server session pooling to be required by the specification - Some quick analysis implies this would be an easy and no-op change
        • If there's contention on this change file a follow up DRIVERS ticket to address this, and make the limiting of session allocation optional for DRIVERS without a session pool
      • Explicitly define that sessions should be acquired at connection checkout and SHOULD NOT (but may in extremely rare circumstances) be released before checkIn
      • Explicitly state that sessions MUST be released and reused to meet the goal of reducing session allocation to be within the bounds of [1, numConcurrentOperationCount)
      • Update test 13 to account for the variability in implementation details (or split out the following into a further test case)
        • Drivers MAY assert that exactly one session is used for all the concurrent operations listed in the test, however this is racey if the session isn't released before checkIn (which SHOULD NOT be attempted)
        • Drivers SHOULD assert that after repeated runs they are able to achieve the use of exactly one session, this will statistically prove we've reduced the allocation amount
        • Drivers MUST assert that the number of allocated sessions never exceeds the number of concurrent operations executing

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: