Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2737

Always set slaveOk for direct connections to replica set members

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 3.6.0
    • 3.6.2
    • Wire Protocol
    • None

    Description

      When an application creates a MongoClient instance that is a direct connection (topology type of "Single" in the parlance of the server selection specification) to a replica set member (e.g. new MongoClient(new ServerAddress("localhost", 27018)), and the read preference mode is "primary", then messages sent to that server via that MongoClient should indicate that the server should execute them regardless of whether the server is the primary member of the replica set.

      For OP_QUERY (for MongoDB versions < 3.6), that means settings the slaveOk wire protocol bit.

      For OP_MSG (for MongoDB versions >= 3.6), that means including a $readPreference field with mode of "primaryPreferred".

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: