Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5924

Improper Modification of Read Concern in Command Post Send

    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      The causal consistency spec and transactions spec state that afterClusterTime must be added to the readConcern on the operation that starts a transaction if a session operationTime is present. There are transaction unified tests that test this specific case. However, our tests fail with:

      [2024/02/12 13:40:07.660] 5) Transactions Spec Unified Tests
      [2024/02/12 13:40:07.660] transaction-options
      [2024/02/12 13:40:07.660] readConcern local in defaultTransactionOptions:
      [2024/02/12 13:40:07.660] AssertionError: object has more keys than expected.
      [2024/02/12 13:40:07.660] actual: [level,afterClusterTime]
      [2024/02/12 13:40:07.660] expected: [level]
      [2024/02/12 13:40:07.660] at resultCheck (test/tools/unified-spec-runner/match.ts:264:18)
      [2024/02/12 13:40:07.660] at checkNestedDocuments (test/tools/unified-spec-runner/match.ts:215:7)
      [2024/02/12 13:40:07.660] at resultCheck (test/tools/unified-spec-runner/match.ts:250:9)
      [2024/02/12 13:40:07.660] at compareCommandStartedEvents (test/tools/unified-spec-runner/match.ts:423:5)
      [2024/02/12 13:40:07.660] at compareEvents (test/tools/unified-spec-runner/match.ts:495:7)
      [2024/02/12 13:40:07.660] at matchesEvents (test/tools/unified-spec-runner/match.ts:647:5)
      [2024/02/12 13:40:07.660] at runUnifiedTest (test/tools/unified-spec-runner/runner.ts:221:22)
      [2024/02/12 13:40:07.660] at processTicksAndRejections (node:internal/process/task_queues:95:5)
      [2024/02/12 13:40:07.660] at async Context.<anonymous> (test/tools/unified-spec-runner/runner.ts:288:11)

       

      This is because the first operation on a session would not have an operationTime as it is returned from the server, so the very first operation on the session would not have afterClusterTime on its readConcern. The driver actually behaves correctly in that when the command is sent, it is not present. However when the CommandStartedEvent is emitted, it is present, indicating that we've modified some instance of the read concern object after sending the message that is altering the events when actually reported.

            Assignee:
            Unassigned Unassigned
            Reporter:
            durran.jordan@mongodb.com Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: