Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-36299

Implement support for exhaust cursors with OP_MSG in DBClientCursor

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.3
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
    • Fully Compatible
    • Repl 2018-08-13, Repl 2018-08-27, Repl 2018-09-10
    • 0

      DBClientCursor will implement the client side of the exhaust cursor OP_MSG protocol when commands are being used and QueryOption_Exhaust is requested.

      • When more() is called after the initial find command, it will set the wire protocol bit exhaustAllowed on the getMore command it sends.  DBClientCursor will not set this bit on initial find commands.  Note that older implementations which do not support OP_MSG exhaust will ignore this bit, as required by the wire protocol spec.
      • When more() is called after there was a response to the getMore command that had the wire protocol moreToCome bit set, it will receive the next batch and make it available to the caller.
      • If the response does not have the moreToCome bit set and it indicates an error or the cursor is exhausted (cursor id of 0), more() will return false.
      • If the response does not have the moreToCome bit set, and also does not indicate the cursor is exhausted or contain an error, DBClientCursor will send another getMore command.  This handles the upgrade case when connecting to a 4.0 implementation which does not support OP_MSG exhaust.

      As part of this work, we will remove OP_QUERY exhaust support from DBClientConnection.  This is currently used only by the database cloner, so the only effect of this will be to cause a performance regression when cloning between 4.0 and 4.2, and the commands which use the database cloner are deprecated.

            william.schultz@mongodb.com William Schultz (Inactive)
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            0 Vote for this issue
            4 Start watching this issue