Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1867

Perform another round of server selection if server selector waited and is at deadline

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.10.0.rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      In the process of making Evergreen green on all configurations, I discovered the following possibility:

      1. Server selector has to select a server.
      2. It waits for SDAM to update the cluster, up to the deadline.
      3. SDAM operates correctly and updates the cluster, and wakes up the server selector.
      4. When the server selector runs again, it notices that it is at deadline (i.e. there is zero or negative time remaining).
      5. Server selector raises NoServerAvailable, but in the diagnostic output for this exception the driver states that the server which was being sought exists in the cluster.

      To fix this, server selector should perform another round of selection if it waited prior to checking the deadline to see if it should wait more. Consequently, the loop in server selection would abort prior to waiting rather than after waiting.

      This change also requires special handling of zero timeout. As server selection always takes some time, zero timeout means it should not be attempted at all. A small timeout (e.g. 1 millisecond) would allow server selector to perform complete cluster inspection and potentially return a server in the cluster, however long that takes (but the selector would not wait on SDAM).

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: