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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.4.9
    • Fix Version/s: None
    • 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
    • Operating System:
      ALL

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: