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

Do not perform server selection to determine sessions support

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Component/s: Sessions
    • Labels:
      None
    • Needed
    • Hide

      Drivers should implement the sessions spec changes in 90cfaef, removing the server selection step for session support and relying exclusively on the `logicalSessionTimeoutMinutes` reported by the checked out connection instead. Two new prose tests are added to ensure the user-facing behavior for explicit and implicit sessions remains unchanged when communicating with a server that does not support sessions. This work is a pre-requisite for sever selection logging (DRIVERS-1671), which will define additional tests to ensure no server selection is performed for session support.

      Show
      Drivers should implement the sessions spec changes in 90cfaef , removing the server selection step for session support and relying exclusively on the `logicalSessionTimeoutMinutes` reported by the checked out connection instead. Two new prose tests are added to ensure the user-facing behavior for explicit and implicit sessions remains unchanged when communicating with a server that does not support sessions. This work is a pre-requisite for sever selection logging ( DRIVERS-1671 ), which will define additional tests to ensure no server selection is performed for session support.
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      CDRIVER-4566 Backlog
      CXX-2643 Backlog
      CSHARP-4504 Done 2.20.0
      GODRIVER-2742 Fixed 1.13.0, 1.13.1
      JAVA-4860 Fixed 4.10.0
      NODE-5017 Done 5.2.0
      MOTOR-1090 Duplicate
      PYTHON-3587 Done
      PHPLIB-1073 Blocked
      RUBY-3212 Backlog
      RUST-1585 Fixed 2.5.0
      SWIFT-1697 Won't Do
      $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-4566 Backlog CXX-2643 Backlog CSHARP-4504 Done 2.20.0 GODRIVER-2742 Fixed 1.13.0, 1.13.1 JAVA-4860 Fixed 4.10.0 NODE-5017 Done 5.2.0 MOTOR-1090 Duplicate PYTHON-3587 Done PHPLIB-1073 Blocked RUBY-3212 Backlog RUST-1585 Fixed 2.5.0 SWIFT-1697 Won't Do

      Currently, the sessions spec has drivers perform server selection to determine sessions support if the support status is not currently known: https://github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst#how-to-check-whether-a-deployment-supports-sessions

      This approach has some known race conditions, as documented in the spec as well (https://github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst#possible-race-conditions-when-checking-whether-a-deployment-supports-sessions).

      Drivers should update their logic to defer checking for sessions support after a connection has actually been checked out. The driver should then check that the particular server supports sessions - that is, the connection has non-null logicalSessionTimeoutMinutes.

      If the user supplied an explicit session and it turns out at this point sessions are not supported for the server, the driver can then raise an error.
      If no user session was supplied (so an implicit session is used) and it turns out at this point sessions are not supported for the server, the driver can ignore the implicit session (the spec already instructs to do this.)

      This approach simplifies session support checking and eliminates 3 of the 4 possible race conditions around sessions.

      This ticket is being proposed as a subset of the original work imagined in DRIVERS-2337.
      This ticket also relates to DRIVERS-759, which changed the spec to permit drivers to defer sessions support checks but would still have sessions support checks performed via server selection.

      New Prose Tests

      • Test that an implicit session is not sent to a server that does not support sessions
      • Test that `startSession` does not error but the explicit session raises a client-side error if specified for a server that does not support sessions

      Note: Server selection logging work DRIVERS-1671 will define additional tests to confirm that no server selection is performed to determine session support.

            Assignee:
            daria.pardue@mongodb.com Daria Pardue
            Reporter:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Jessica Sigafoos Jessica Sigafoos
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: