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

QueryCache raise on recalled getMore queries

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.0.4, 7.0.5
    • Component/s: Query
    • Labels:
      None

      Hello,

      First, I don’t really know since which version the issue occurs; but on a Rails project (Prod env) we have the issue with the previous version (7.0.4) but with a different error message.

      So, when `Mongoid::QueryCache` is `enabled`, all requests with a response larger than the `batch_size` cannot be called twice, even without one explicitly set.
      When calling it twice, it raises a `NotImplementedError: Cannot restart iteration of a cursor which issued a getMore`.
      I also tried with several older combo versions of Mongoid and Mongo driver and it raises: `Mongo::Error::OperationFailure (Cursor not found, cursor id: 140000000000 (40))`.
      I've seen in the source code that `Mongoid::QueryCache` is supposed to handle requests using `getMore` with a patch on the mongo driver. The problem is that it isn’t working as expected. The `process` method looks correctly overrided but I didn’t go deeper.

      To ensure this issue can be reproduced, I have created a minimal project: guille-moe/mongoid-query-cache-test
      A typical example with the issue can be found here: guille-moe/mongoid-query-cache-test/spec/models/user_spec.rb

            Assignee:
            Unassigned Unassigned
            Reporter:
            pro@guille.moe Paul Guillemot
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: