查看不同的mongodb操作我发现mongodb 3.0,WT引擎正在生成许多不同的锁,有时甚至升级到全局锁,如下所示:
{
"desc" : "conn4981286",
"threadId" : "0x113f133400",
"connectionId" : 4981286,
"opid" : -371204669,
"active" : true,
"secs_running" : 0,
"microsecs_running" : NumberLong(377),
"op" : "update",
"ns" : "xxx",
"query" : {
"_id" : ObjectId("56c82738ccb2d079eec4867c")
},
"client" : "xxx",
"numYields" : 0,
"locks" : {
"Global" : "w",
"local" : "w",
"Database" : "w",
"Collection" : "w"
},
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(2),
"w" : NumberLong(2)
}
},
"Database" : {
"acquireCount" : {
"w" : NumberLong(2)
}
},
"Collection" : {
"acquireCount" : {
"w" : NumberLong(1)
}
},
"oplog" : {
"acquireCount" : {
"w" : NumberLong(1)
}
}
}
},
为什么更新会生成所有这些锁? 谢谢!