Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1530

Tailable cursor only works with MONGOC_QUERY_AWAIT_DATA

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.1, 1.5.0
    • Affects Version/s: 1.4.0
    • Component/s: None
    • None

      Tailable cursors without the MONGOC_QUERY_AWAIT_DATA flag seem to close out when connected to a MongoDB 3.2. This behavior is not observed when connected to 3.0 or earlier MongoDB. It is not clear if earlier versions of the driver are affected also.

      Attempting to read a tailable cursor repeatedly without the above flag generates the error "Cannot advance a completed or failed cursor."

      The documentation for tailable cursors shows the first example without this flag so it seems like it's an acceptable thing to do:
      https://github.com/mongodb/specifications/blob/master/source/find_getmore_killcursors_commands.rst#tailable-cursors

      Looking through the code for the C Driver though it appears that merely having no payload in getMore results will cause the cursor to be marked as "done". Reading from such a marked cursor triggers an error on the next getMore attempt (the same error as mentioned above). This seems to be the wrong behavior, but I'm not sure.

      See attached code, which is a slight modification of the Github example for using tailable cursors in the C driver.

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrew.ryder@mongodb.com Andrew Ryder (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: