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

Force non-QC read with QC storage

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Query
    • Fully Compatible

      Mongoid has a feature where calling reload on a model would not read from query cache:

          # Bypass the query cache when reloading a document.
          module Document
            def reload
              QueryCache.uncached { super }
            end
          end
      

      When QC is enabled, what I assume would then happen is if the model in question was in the cache, this call would read from the database but the cache wouldn't be cleared and subsequent queries of this model might use the (stale) data from cache.

      I can see this solved in one of two ways:

      • Add a mechanism where the query would always be fulfilled from the database but the result would be written to query cache
      • When QueryCache was enabled in outer scope and is disabled in inner scope, any query on a collection + any write query would invalidate the respective cache(s) but not write to them.

      The first approach seems to provide more value to applications.

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

              Created:
              Updated: