lockInfo
定义
兼容性
此命令可用于以下环境中托管的部署:
MongoDB Atlas:用于云中 MongoDB 部署的完全托管服务
重要
M 0 、M 2和 M 5集群不支持此命令。 有关更多信息,请参阅不支持的命令。
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
语法
要运行,请对admin
数据库发出命令:
db.adminCommand( { lockInfo: 1 } )
输出示例
{ "lockInfo" : [ { "resourceId" : "{2305843009213693953: ParallelBatchWriterMode, 1}", "granted" : [ { "mode" : "IS", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "{ findandmodify: \"hugeindex\", query: { _id: 585.0 }, update: { $pop: { a: 1.0 } }, upsert: false, new: false, lsid: { id: UUID(\"dc611138-04c6-49b1-a7ac-161040dd9d65\") }, $db: \"test\" }", "clientInfo" : { "desc" : "conn3", "connectionId" : 3, "client" : "127.0.0.1:55165", "opid" : 28770 } } ], "pending" : [ ] }, { "resourceId" : "{6917529027641081857: Global, 1}", "granted" : [ { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "{ findandmodify: \"hugeindex\", query: { _id: 585.0 }, update: { $pop: { a: 1.0 } }, upsert: false, new: false, lsid: { id: UUID(\"dc611138-04c6-49b1-a7ac-161040dd9d65\") }, $db: \"test\" }", "clientInfo" : { "desc" : "conn3", "connectionId" : 3, "client" : "127.0.0.1:55165", "opid" : 28770 } }, { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "index build: 29d48366-63ad-41e2-a689-69255a89c094", "clientInfo" : { "desc" : "IndexBuildsCoordinatorMongod-0", "opid" : 27437 } } ], "pending" : [ ] }, { "resourceId" : "{4611686018427387905: ReplicationStateTransition, 1}", "granted" : [ { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "{ findandmodify: \"hugeindex\", query: { _id: 585.0 }, update: { $pop: { a: 1.0 } }, upsert: false, new: false, lsid: { id: UUID(\"dc611138-04c6-49b1-a7ac-161040dd9d65\") }, $db: \"test\" }", "clientInfo" : { "desc" : "conn3", "connectionId" : 3, "client" : "127.0.0.1:55165", "opid" : 28770 } }, { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "index build: 29d48366-63ad-41e2-a689-69255a89c094", "clientInfo" : { "desc" : "IndexBuildsCoordinatorMongod-0", "opid" : 27437 } } ], "pending" : [ ] }, { "resourceId" : "{10123292395995783581: Database, 899920359141007773, test}", "granted" : [ { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "{ findandmodify: \"hugeindex\", query: { _id: 585.0 }, update: { $pop: { a: 1.0 } }, upsert: false, new: false, lsid: { id: UUID(\"dc611138-04c6-49b1-a7ac-161040dd9d65\") }, $db: \"test\" }", "clientInfo" : { "desc" : "conn3", "connectionId" : 3, "client" : "127.0.0.1:55165", "opid" : 28770 } }, { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "index build: 29d48366-63ad-41e2-a689-69255a89c094", "clientInfo" : { "desc" : "IndexBuildsCoordinatorMongod-0", "opid" : 27437 } } ], "pending" : [ ] }, { "resourceId" : "{12576221391967629173: Collection, 1047006345899159413, test.hugeindex}", "granted" : [ { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "{ findandmodify: \"hugeindex\", query: { _id: 585.0 }, update: { $pop: { a: 1.0 } }, upsert: false, new: false, lsid: { id: UUID(\"dc611138-04c6-49b1-a7ac-161040dd9d65\") }, $db: \"test\" }", "clientInfo" : { "desc" : "conn3", "connectionId" : 3, "client" : "127.0.0.1:55165", "opid" : 28770 } }, { "mode" : "IX", "convertMode" : "NONE", "enqueueAtFront" : false, "compatibleFirst" : false, "debugInfo" : "index build: 29d48366-63ad-41e2-a689-69255a89c094", "clientInfo" : { "desc" : "IndexBuildsCoordinatorMongod-0", "opid" : 27437 } } ], "pending" : [ ] } ], "ok" : 1 }
输出字段
lockInfo.granted
一个文档数组。每个文档都提供有关当前在资源上授予的锁的信息。
lockInfo.pending
一个文档数组。每个文档都提供有关资源上当前处于待处理状态的锁的信息。
锁信息
字段 | 说明 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
mode | 指定锁模式:
| ||||||||||
convertMode | 指定用于转换的新锁定模式。 | ||||||||||
enqueueAtFront | 一个布尔值,指示在发生冲突时是将锁放在队列的前面还是后面。 | ||||||||||
compatibleFirst | 布尔值,表示根据与已授权锁的兼容性授予锁请求,或使用先进先出 (FIFO) 顺序。 | ||||||||||
debugInfo | 有关发出锁请求的操作的信息。 | ||||||||||
clientInfo | 详细说明客户信息的文档。 |