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

Consider omitting readPreference option in commands/queries to non-sharded topologies

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      As noted in CDRIVER-2744:

      I realize that it's a bit redundant for PHPLIB to add a read preference to a query if we're not communicating with mongos, since we would have already done server selection by this point. That is likely be something we can refactor independently of this issue.

      Since PHPLIB executes its operations on a MongoDB\Driver\Server, it may be redundant to specify a "readPreference" option in commands and queries if we're not executing the operation on a mongos node.

      The only edge case I can think of is whether secondaries still using OP_QUERY may still require a wire protocol bit set and whether libmongoc infers that from the read preference. According to the Server Selection spec, the bit should always be set when communicating with a mongod in standalone mode. We should confirm whether libmongoc will automatically set the bit if we're sending a command/query to a secondary after PHPLIB has performed its server selection in a replica set topology.

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

              Created:
              Updated: