We recently upgraded our mongo replica set from 2.4 to 2.6.12 and are having the strange behavior that the primary uses the indexes and the secondaries do not.
for instance this query:
query fitly_metrics_production.rank_ledger_entries query: { $query: {
user_id: ObjectId('56dd084df093a136580be18a'), category: "chest" },
$orderby: { _id: -1 } } planSummary: IXSCAN { _id: 1 } ntoskip:0
nscanned:1645536 nscannedObjects:1645536 keyUpdates:0 numYields:12866
locks(micros) r:138352610 nreturned:1 reslen:316 481856ms
when run explain() on it on the same box we see
{
"cursor" : "BtreeCursor user_id_1_category_1",
"isMultiKey" : false,
"n" : 9,
"nscannedObjects" : 9,
"nscanned" : 9,
"nscannedObjectsAllPlans" : 30,
"nscannedAllPlans" : 30,
"scanAndOrder" : true,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"user_id" : [
[
ObjectId("56dd084df093a136580be18a"),
ObjectId("56dd084df093a136580be18a")
]
],
"category" : [
[
"chest",
"chest"
]
]
},
"server" : "ip-10-7-2-11:27017",
"filterSet" : false
}
and when run on the primary it does hit the index properly, we have two secondaries and this is occurring on both secondaries.
Any idea of what is going on? Thanks.