Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-691

Helpers and internal command calls that don't obey read preference shouldn't raise UserWarning

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.1, 3.0
    • Affects Version/s: 2.7
    • Component/s: None
    • Labels:
      None

      In PYTHON-577 we started raising UserWarning when a call to db.command ignores the user specified read preference and re-directs the command to the primary. This happens for any command not listed in read_preferences.secondary_ok_commands.

      Unfortunately a number of internal calls to db.command, and helpers for commands that don't obey read preference, are causing UserWarning to be raised when db.read_preference is set to anything other than PRIMARY.

      A few things need to be fixed:

      • Helpers that don't obey read preference should explicitly pass ReadPreference.PRIMARY to db.command.
      • Internal calls for non-obedient commands should do the same (e.g. md5sum in gridfs)
      • The test suite should be fixed so that problems like this aren't obscured in the future.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: