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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.4.9
    • Sharding
    • None
    • Sharded cluster with 2 shards
      One shard is in read-only mode (no primary)
      test.test is a sharded collection on _id
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: