Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1163

Do not allow a session to be used with an unacknowledged write concern

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.4
    • Affects Version/s: 1.4.0
    • Component/s: None
    • None

      Per the Driver Session spec:

      Therefore drivers MUST NOT send a session ID with unacknowledged writes under any circumstances:

      • For unacknowledged writes with an explicit session, drivers SHOULD raise an error. If a driver allows users to provide an explicit session with an unacknowledged write (e.g. for backwards compatibility), the driver MUST NOT send the session ID.
      • For unacknowledged writes without an explicit session, drivers SHOULD NOT use an implicit session. If a driver creates an implicit session for unacknowledged writes without an explicit session, the driver MUST NOT send the session ID.

      Drivers MUST document the behavior of unacknowledged writes for both explicit and implicit sessions.

      PHPC-1152 added logic to create an implicit session for executeCommand() (and related methods). If an unacknowledged write concern is passed, we should ensure that an implicit session is not created for the command.

      Two edge cases remain, but should be tested:

      • If the user calls executeReadWriteCommand() or executeWriteCommand() with or without a session option and without a write concern, it's possible that libmongoc may still inherit an unacknowledged write concern from the manager. We can try to check that in PHPC, but that's likely better fixed in libmongoc.
      • PHPC has no logic to create implicit sessions for executeBulkWrite(); however, we should check if libmongoc correctly disallows executing a bulk write with an unknowledged write concern (either explicitly provided or inherited from the manager) and a session (either explicitly provided or implicitly generated by libmongoc).

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: