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

DBTCPConnector ignores readprefs for combination of legacy settings

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.9.2, 2.10.0
    • Affects Version/s: 2.9.0
    • Component/s: API
    • None
    • Minor Change

      The method DBTCPConnector#call incorrectly deals with read preferences when:

      • The read-preference on the DB or Mongo has been set to (the deprecated) ReadPreference.PRIMARY
      • The options on the collection or query have been set to include Bytes#QUERYOPTION_SLAVEOK

      The beginning of the method tests the passed readPref against ReadPreference.primary() using object equality, so the inferred use of ReadPreference.secondaryPreferred() for slaveOk queries is not triggered.

      The default read preference on the mongo is ReadPreference.primary() in the v2.9.0 dist, so this bug only affects code written against older releases that explicitly set ReadPreference.PRIMARY at some point.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            matt.schemmel Matt Schemmel
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: