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

Refactor background threading code

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

      As a prerequisite for both background connection pool thread and SRV polling, existing code in the driver pertaining to background threads needs to be refactored. This covers the following changes:

      1. Schedule finalizers for all background threads prior to starting the threads.
      2. Remove the DescriptionChanged event of the legacy event system. Some vestiges of the legacy event system will remain but we wouldn't have any more legacy events defined.
      3. With DescriptionChanged event gone, all of the sdam-related bits will now be encapsulated in the cluster. This includes sdam flow, sdam flow lock and server selection semaphore.
      4. Move heartbeat interval from server monitor to cluster. This interval is one reason why a new cluster would be created, hence make the cluster responsible for owning the monitor.
      5. Move server description, last scan time, round trip average from server monitor to server. These are all server attributes and while the monitor updates them, the server is the entity that owns them (and on which they should be mocked/stubbed, for example).
      6. Server monitor will purely deal with monitoring, i.e. periodic ismaster calls and sdam flow invocations. It will not maintain any state that is not directly required for monitoring.

      As a result of these changes, the tests can now clearly specify whether they want a real server, a server object that doesn't set up any monitoring, or a server object that doesn't set up monitoring but that provides the appearance of a particular server through mocking.

      There is an associated speedup in the test suite due to a large number of server instantiations now being performed with monitoring io disabled.

            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: