Align with CMAP spec on deferring marking pool "ready"

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: CMAP
    • None
    • None
    • Go Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Detailed steps to reproduce the problem?

      The CMAP spec says:

      When a pool is created, its state MUST initially be set to "paused". Even if minPoolSize is set, the pool MUST NOT begin being populated with Connections until it has been marked as "ready". SDAM will mark the pool as "ready" on each successful check.

      The Go driver marks ready from *topology.Server.Connect() with no check having succeeded, the argument being that accepting that a misconfigured server may spawn doomed connections until the first check fails, as noted in the PR description:

      proactive pool.ready() behavior exists to improve startup usability/perf, and that stricter spec compliance should happen in a separate ticket

      However, there are a few reasons why this doesn’t matter:

      1. With minPoolSize = 0 (the default), there's no background population at all.
      2. The overlap benefit only exists if a user explicitly sets minPoolSize > 0, and even then it saves a single connection-handshake RTT, once, on the first operation.
      3. This does not affect mongo.Connect() which stays non-blocking, which would be breaking. It only affects operations executed on the subsequent mongo.Client.

      Definition of done: what must be done to consider the task complete?

      Do not mark the pool as ready in *topology.Server.Connect() except for when load balancing or when the monitor is disabled:

      if s.cfg.loadBalanced || s.cfg.monitoringDisabled {
          return s.pool.ready()
      }
      

      and then unskip the following test:

      TestUnifiedSpec/server-discovery-and-monitoring/tests/unified/pool-clear-min-pool-size-error.json/Pool_is_not_cleared_on_handshake_error_during_minPoolSize_population
      

      Additionally, we should add a test ensuring mongo.Connect() does not block if the first heartbeat never succeeds.

      The exact Go version used, with patch level:

      N/A

      The exact version of the Go driver used:

      N/A

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      N/A

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      N/A

      Security Vulnerabilities

      None

            Assignee:
            Preston Vasquez
            Reporter:
            Sergey Zelenov
            None
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: