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

localThresholdMS should be a global immutable value

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Major Change

      Currently local threshold is set as an option for individual instances of read preference classes:

      # PyMongo 3.0-dev, removed by this change.
      from pymongo.read_preferences import Secondary
      rp = Secondary(latency_threshold_ms=20000)
      

      This ticket tracks making localThreshold global and immutable. That is, it can only be set through the URI option localThresholdMS, or passed to the constructor for MongoClient as a keyword argument:

      client = pymongo.MongoClient('mongodb://localhost:27017/?localThresholdMS=20000')
      client = pymongo.MongoClient(localThresholdMS=20000)
      

      It can not be reset after client creation and is not settable per Database, Collection, or operation. mongos does not support per operation changes to localThreshold through the $readPreference directive, so the existing driver API can lead to dramatic behavior changes when migrating from a standalone mongod or replica set to a sharded cluster.

            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: