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

mongoc_cmd_parts_assemble() may add readConcern afterClusterTime to generic commands

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • Labels:
      None
    • Environment:
      MongoDB Enterprise 3.6.0

      While running something similar to test #2 in the Driver Sessions spec, I received a server error ("afterClusterTime is not allowed for this command") on the second of two ping commands sent with the same explicit client session. This was using the generic mongoc_client_command_with_opts() command runner with the "sessionId" option.

      According to the Causal Consistency spec:

      The Read and Write Concern Specification states that drivers MUST NOT add a readConcern field to commands that are run using a generic runCommand method. The same is true for causal consistency, so commands that are run using runCommand MUST NOT have an afterClusterTime field added to them.

      Looking at mongoc_cmd_parts_assemble(), I believe that we're entering this condition. libmongoc is only checking that the command is not a getMore before deciding to add a read concern with afterClusterTime. I think it may need to track whether the command supports a read concern (similar to is_write_command on mongoc_cmd_parts_t).

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: