Follow dba-ninja.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

dba-ninja.com Links

Dba_db2_button

Sqlserver_dba_button

Cannot perform operation: an index build is currently running for collection

08 November,2024 by Rambler

Question: I'm trying to rename a MongoDB collection but getting the following warning : 

Cannot perform operation: an index build is currently running for collection

 

Answer: Use this command from to identify the operation 

db.adminCommand(
    {
      currentOp: true,
      $or: [
        { op: "command", "command.createIndexes": { $exists: true }  },
        { op: "none", "msg" : /^Index Build/ }
      ]
    }
)



You can also use the aggregate function


db.aggregate( [    { $currentOp : { allUsers: true, idleConnections: false } },    { $match : { client: "10.11.33.99", microsecs_running: {$gt: 10000} }}, {$project: { _id:0, host:1, opid:1, secs_running: 1, op:1, ns:1, waitingForLock: 1, numYields: 1  } } ] ).pretty()

db.aggregate( [    { $currentOp : { allUsers: true, idleConnections: false } },    { $match : { client: "10.11.33.99" }}, {$project: { _id:0, host:1, opid:1, secs_running: 1, op:1, ns:1, waitingForLock: 1, numYields: 1  } } ] ).pretty()

db.aggregate( [    { $currentOp : { allUsers: true, idleConnections: false } },   {$project: { _id:0, client:1,host:1, opid:1, secs_running: 1, op:1, ns:1, waitingForLock: 1, numYields: 1  } } ] ).pretty()

db.aggregate( [    { $currentOp : { allUsers: true, idleConnections: false } },   {$project: { _id:0, client:1,host:1, opid:1, secs_running: 1, op:1, ns:1, waitingForLock: 1, numYields: 1  } } ] ).pretty()

db.aggregate( [    { $currentOp : { allUsers: true, idleConnections: false } },  { $match : { ns: "mydb.mycollection"}}, {$project: { _id:0, client:1,host:1, command:1,opid:1, secs_running: 1, op:1, ns:1, waitingForLock: 1, numYields: 1  } } ] ).pretty()









 

Depending on the circumstances it may be necessary to kill the operatoiom

db.currentOp()

db.killOp(74747474)

Author: Rambler (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Cannot perform operation: an index build is currently running for collection


dba-ninja.com