Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4785

Mongoid forces legacy read retries regardless of driver configuration

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0.rc1
    • Affects Version/s: None
    • Component/s: None
    • None

      When modern retryable reads were implemented in https://jira.mongodb.org/browse/RUBY-1562, there was a compatibility issue with existing Mongoid query cache code (which copied a portion of the driver's cursor implementation). This was fixed in https://github.com/mongodb/mongo-ruby-driver/pull/1348 by having the driver accept the Mongoid no-argument invocation of read_with_retry. Unfortunately when this happens, the driver uses the legacy read retry mechanism even if the modern mechanism is configured.

      The driver contains the following note in a comment:

              # Older versions of Mongoid call read_with_retry without arguments.
              # This is already not correct in a MongoDB 3.6+ environment with
              # sessions. For compatibility we emulate the legacy driver behavior
              # here but upgrading Mongoid is strongly recommended.
      

      However, as far as I can see the respective Mongoid change was never implemented.

      Either Mongoid needs to be updated to invoke the driver correctly, such that modern retryable reads are used, or query cache implementation needs to be moved into the driver.

      In the mean time, https://jira.mongodb.org/browse/RUBY-1986 will allow seamless handling of "node shutting down" errors in applications that are using old versions of Mongoid but modern Ruby driver.

            Assignee:
            grace.chong@mongodb.com Grace Chong (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: