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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 1.4.0
    • 1.4.4
    • None
    • None

    Description

      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).

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: