Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12221

Sleep in ReplicaSetMonitor::_check is causing latency for slaveOk() queries in sharded cluster when there is no primary

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.9
    • Component/s: Sharding
    • Labels:
      None
    • Environment:
      Sharded cluster with 2 shards
      One shard is in read-only mode (no primary)
      test.test is a sharded collection on _id
    • ALL

      With SERVER-7246 we allow slaveOk() queries to proceed even if there is no primary in the shard. However, the latency of those queries will never be less than 2 seconds because we call ReplicaSetMonitor::_check to check the hosts, and it does two retries to detect the primary, sleeping 1 sec after each one: https://github.com/mongodb/mongo/blob/v2.4/src/mongo/client/dbclient_rs.cpp#L1030

      2 seconds minimum latency for the query is not a good thing in most environments, even for an edge case when no primary is available.

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            alex.komyagin@mongodb.com Alexander Komyagin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: