Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4262

make startSession work without a connection to MongoDB

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.8.0
    • Affects Version/s: None
    • Component/s: None
    • Not Needed

      What problem are you facing?

      Session creation does not require a connection, we need to refactor the creation logic to avoid throwing an error when the topology hasn't been created yet.

      This impacts cursor iteration, implicit session is created lazily on the first iteration currently, and it will omit a session altogether if the client hasn't been connected.

      AC:

      1. MongoClient's startSession should succeed regardless of connected state
        • Remove startSession from topology, move logic to MongoClient.
      2. make MongoClient responsible for session cleanup
        • Remove endSessions from topology
        • Client will now have to have the endSessions command logic in it's close function
        • If the client isn't connected, then it should not connect just to send an endSessions command
      3. Refactor the session leak checker to use the MongoClient interfaces / tracking
      4. Ensure that cursor's can be iterated directly after creation
        • (.watch() -> .next()) and there is a session attached to the initial command and the following getMore's that is the same lsid.
        • This will be a new test that specifically makes sure this scenario is possible on a non-connected client
      5. Audit the MongoNotConnectedError usages, this may eliminate all need for them

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: