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

Indexes on local.oplog.$main

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Hello,

      Last night I saw the following query running on our one of our MongoDB client's masters:

      > db.currentOp();
      {
      "inprog" : [
      {
      "opid" : 3,
      "active" : 1,
      "secs_running" : 34,
      "op" : "query",
      "ns" : "local.oplog.$main",
      "query" : "{ query: {}, orderby:

      { ts: -1 }

      }",
      "inLock" : 1,
      "client" : "10.6.126.130:39718"
      }
      ]
      }

      That's actually from the Nagios replication check plugin that we implemented (based on the quick and dirty replication check script you Eliot wrote with Tim and I watching while we were in NYC last Decmber) and what concerns me is how long it took to run. The whole script is attached but here's the relevant line:

      master_oplog = master_local["oplog.$main"].find.sort([["ts", -1]]).limit(1).to_a.first

      So, my questions:

      1. Is there a better way to get the master's current oplog timestamp?

      2. Are there indexes on the local.oplog.$main collection? 'db.system.indexes.find();' run on the local db only shows in index on the name field of the users collection, but then 'show collections' doesn't show the oplog collection.

      3. Can an index be added to help that query?

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            ejones Erik Jones
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: