Search code examples
mongodbkillsharding

Does killOp work in sharded mongo?


I am trying to kill a malformed query on mongoDB but I am finding that if I do a db.currentOp() after doing db.killOp(opid), the query is still there with a new opid. Our mongoDB is sharded and I noticed the shard changes in the opid after it being killed.

This made me wonder if maybe my "problem" is actually a feature/result of the db being sharded? Googling brings up a few results from late last year claiming that you cannot use killOp when mongo is sharded but given the posts are old, and I can't find anything official & current confirming this fact, I thought I would double check here.

Thank you very much for any help you can offer. And if anyone has a clever solution for how you CAN kill an errant query in a sharded mongo DB, I'd really appreciate the help. Thanks again.


Solution

  • Killing an operation in a sharded environment requires that you manually kill it on every shard; see https://jira.mongodb.org/browse/SERVER-6496. Hope this helps.