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

Server executeQuery() and executeCommand() methods should take a ReadPreference

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.0.0-beta1
    • Affects Version/s: 1.0.0-alpha2
    • Component/s: None
    • None

      This ticket grew out of a question raised in PHPC-378 regarding Server and Manager interfaces.

      In order to support passage of a read preference to mongos through the Server API, executeQuery() and executeCommand() should take a ReadPreference.

      bjori and I discussed what should happen if the passed ReadPreference doesn't agree with the Server's status (e.g. sending a primary read preference through a secondary Server's execute method). I'm of the opinion we shouldn't check, but rather assume the user has intentionally selected the Server via the Manager's getServers() or selectServer() method and would just like the ReadPreference packaged into the query/command (and slaveOk bit set on the wire protocol as needed).

      Outstanding question: how will libmongoc's mongoc_collection_find() or mongoc_client_command() functions react to setting a read preference that doesn't logically agree with a positive cursor hint? Note that we set -1 as the hint when we want server selection to kick in (e.g. through Manager::executeQuery()).

            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: