Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-2127

Clarify if OP_QUERY should always be used for monitoring and/or initial handshake

    • Type: Icon: Spec Change Spec Change
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: OP_MSG, SDAM
    • Labels:
      None
    • Needed

      An ismaster is sent for (1) periodic SDAM monitoring and (2) during the initial handshake when opening a new socket to a server. It is not clear to me for both cases whether the ismaster should always be sent with OP_QUERY, or if we should use OP_MSG if the current server description indicates it supports OP_MSG. I think we should clarify in both cases which wire protocol to use.

      OP_MSG spec says:

      OP_MSG is only available in MongoDB 3.6 (maxWireVersion >= 6) and later. MongoDB drivers MUST continue to perform the MongoDB Handshake using OP_QUERY to determine if the node supports OP_MSG.
      
      If the node supports OP_MSG, any and all messages MUST use OP_MSG, optionally compressed with OP_COMPRESSED.
      

      I'm not sure if that means we should always use OP_QUERY for ismaster, or if we should use OP_MSG for ismaster if the current server description indicates that the server supports OP_MSG.

      SDAM spec says that the reply to an initial handshake ismaster should also used to update the server/topology description.

      If we're using the reply to the initial handshake to update our server/topology description, then the initial handshake is a part of monitoring as well. That indicates to me that if we decide to always use OP_QUERY for monitoring, we should always do so for the handshake.

      FWIW, libmongoc always uses OP_QUERY for monitoring. And as was discovered in CDRIVER-3404, may use OP_MSG for the handshake if the last server description had a high enough maxWireVersion.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: