建索引的时候没有任何提示,一直提示正在建
通过mongosh键入:
db.currentOp().inprog.filter(x => x.waitingForLatch && x.waitingForLatch.captureName === 'IndexBuildsCoordinator::_mutex')
运行结果如下:
[
{
type: 'op',
host: 'ubuntu:33090',
desc: 'conn19931',
connectionId: 19931,
client: '111.111.111.111:12313',
appName: 'MongoDB Compass',
clientMetadata: {
driver: [Object],
os: [Object],
platform: 'Node.js v14.16.0, LE (unified)|Node.js v14.16.0, LE (unified)',
application: [Object]
},
active: true,
currentOpTime: '2022-01-19T18:59:09.913+08:00',
effectiveUsers: [ [Object] ],
opid: 1956377797,
lsid: {
id: UUID("ab2ff5d3-1af8-4dc4-ade7-c7f742b9b22b"),
uid: Binary(Buffer.from("13cbe34f636d20d83372568304ecc5d8a43ffa8b600aa27b0783e699fc7e6185", "hex"), 0)
},
secs_running: Long("12"),
microsecs_running: Long("12180478"),
op: 'command',
ns: 'his.lc_hotel',
command: {
createIndexes: 'tt_09',
indexes: [Array],
lsid: [Object],
'$clusterTime': [Object],
'$db': 'his'
},
numYields: 0,
waitingForLatch: {
timestamp: 2022-01-19T10:58:57.833Z,
captureName: 'IndexBuildsCoordinator::_mutex'
},
locks: { ReplicationStateTransition: 'w', Global: 'w' },
waitingForLock: false,
lockStats: {
ParallelBatchWriterMode: [Object],
ReplicationStateTransition: [Object],
Global: [Object],
Database: [Object],
Collection: [Object],
Mutex: [Object]
},
waitingForFlowControl: false,
flowControlStats: { acquireCount: Long("2"), timeAcquiringMicros: Long("1") }
}
]
可以通过db.killOp(opid)强行终止,不过还是无法新建索引