Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-698

Ensure all operations error when using explicit read or write concern within a transaction

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      In mongodb/mongo-php-library#840, there is a check to raise a client-side error when using an explicit write concern within a transaction. To quote:

      Explicit read/writeConcerns are prohibited within a transaction, but renameCollection is not in the list of commands that can be run within a transaction.

      This bit of code was copied from other operation classes, most of which are for commands that are supported in transactions; however, this is also found in some prohibited ops such as DropCollection. All of this dates back to 39f59b2 (PHPLIB-368) so it's quite possible it was an oversight and missed during that review.

      I suppose one could argue it's safer to keep this check on any operation that solicits a read/writeConcern on the off chance these ops become allowed within transactions down the line. In that case, we should confirm that we have this in all ops that take explicit read/writeConcerns.

      These checks can remain in place in the interest of defensive programming, but we should also audit the code to ensure the checks are done in all operations that take an explicit read and/or write concern.

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

              Created:
              Updated: