-
Type: Question
-
Resolution: Done
-
Priority: 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:
}",
"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?