我如何在Mongo中拥有并发读写锁?

时间:2014-09-11 18:55:01

标签: mongodb concurrency

以下是db.currentOp()的摘录:

{
        "opid" : 71144,
        "active" : false,
        "op" : "query",
        "client" : "127.0.0.1:41889",
        "desc" : "conn2",
        "threadId" : "0x7fc3e4b4d700",
        "connectionId" : 2,
        "locks" : {
                "^pophealth-production" : "W"
        },
        "waitingForLock" : true,
        "numYields" : 0,

},
{
        "opid" : 70981,
        "active" : true,
        "secs_running" : 2647,
        "op" : "query",
        "ns" : "pophealth-production.records",
        "query" : {
                "$msg" : "query not recording (too large)"
        },
        "client" : "127.0.0.1:41890",
        "desc" : "conn3",
        "threadId" : "0x7fc3e4a4c700",
        "connectionId" : 3,
        "locks" : {
                "^" : "r",
                "^pophealth-production" : "R"
        },
        "waitingForLock" : false,
        "numYields" : 5,

一个线程如何持有写锁定但另一个线程持有读锁定怎么可能?不应该写锁定会阻止读锁定吗?或active: false标志是否意味着第一个进程实际上没有锁定?

0 个答案:

没有答案