lockInfo

On this page本页内容

Definition定义

lockInfo

Returns information on locks that are currently being held or pending. 返回当前被保留或挂起的锁的信息。lockInfo is an internal command available on mongod instances only.lockInfo是仅在mongod实例上可用的内部命令。

Syntax语法

To run, issue the command against the admin database:要运行,请针对admin数据库发出命令:

db.adminCommand( { lockInfo: 1 } )

Output Example输出示例

The following is an example of the output from the lockInfo:以下是lockInfo的输出示例:

{
   "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
}

Output Fields输出字段

lockInfo

An array of documents that report on the lock information. 报告锁信息的文档数组。Each document includes:每份文件包括:

lockInfo.resourceId

The resource on which the locks are being held or pending.锁定所在或挂起的资源。

lockInfo.granted

An array of documents. 一系列文档。Each document provides information on locks that are currently granted on the resource.每个文档都提供有关当前授予资源的锁的信息

lockInfo.pending

An array of documents. 一系列文档。Each document provides information on locks that are currently pending on the resource.每个文档都提供了有关资源上当前挂起的锁的信息

Lock Information锁信息

For each granted or pending lock document, information include:对于每个grantedpending的锁定文档,信息包括:

Field字段Description描述
mode

Specifies the lock mode:指定锁定模式:

Lock Mode锁定模式Description描述
SShared共享
XExclusive独家
ISIntent Shared共享的意图
IXIntent Exclusive (IX)专用意向(IX)
convertModeSpecifies the new lock mode for conversion.指定转换的新锁定模式。
enqueueAtFrontA boolean that indicates whether to put the lock at the front of the queue or the back in case of conflict. 一个布尔值,指示在发生冲突时是将锁放在队列的前面还是后面。
compatibleFirstA boolean that indicates to grant lock requests based on compatibility with already granted locks or to use the first-in-first-out (FIFO) order. 一种布尔值,指示基于与已授予的锁的兼容性来授予锁请求,或使用先进先出(FIFO)顺序。
debugInfoInformation about the operation that issued the lock request.有关发出锁定请求的操作的信息。
clientInfoA document detailing the client information.详细说明客户信息的文档。
←  listCommandsnetstat →