[SERVER-12607] Write commands should be interruptable with killOp Created: 04/Feb/14  Updated: 11/Jul/16  Resolved: 04/Mar/14

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.5.5
Fix Version/s: 2.6.0-rc1

Type: Bug Priority: Critical - P2
Reporter: Eric Milkie Assignee: Eric Milkie
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-11432 Audit usage of checkForInterrupt(false) Closed
is related to SERVER-12762 Batch inserts should be counted and p... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Currently, write commands use nested curops to do their write operations. Nested curops occlude their parent in the currentOp list, so the only thing users will see is the current operation of a write command, with no parent. Killing that op will result in just that one op being flagged with an error, and the write command will continue applying the rest of the ops as it would for any other write error.

There are two problems to be solved here.

First, the write command driver needs to specially trap the "interrupted" exceptions thrown from an individual write op and pass them up to the command handler. In addition, when a write op completes, the write command driver needs to checkForInterrupt before it unwraps the nested curop, in case the killed flag is set but the write op never checked it. Otherwise, we would throw away the killed flag and never notice it was set.

Second, as the write command proceeds through its write ops, the currentOp display will spin through op ids rather quickly, which will make it very difficult for a user to kill the operation. I propose that we make modifications to the currentOp info() function such that it traces through a nested op into the parent, such that it builds a tree to display the parent op, with its associated op id, in addition to any nested ops. This would allow a user to discern the parent op id and use that in killOp to abort a long-running write command.
Unfortunately, this will change the currentOp display in a way that may break scripts that are looking for certain fields to identify specific operations.



 Comments   
Comment by Githook User [ 03/Mar/14 ]

Author:

{u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-12607 make [update/delete] write commands interruptable with killOp
Branch: master
https://github.com/mongodb/mongo/commit/e2ee0675ee7f97d2ed92d85ea514ebaef1d498d7

Comment by Eric Milkie [ 18/Feb/14 ]

Note: inserts are still not interruptable; see SERVER-12762

Comment by Githook User [ 18/Feb/14 ]

Author:

{u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-12607 allow update/delete write commands to be interrupted

Note that batch inserts are not interruptable, due to the way it is currently
handling CurOp objects.
Branch: master
https://github.com/mongodb/mongo/commit/d2a27b0980651c8cb68c06ef3d677498c06ebb68

Generated at Thu Feb 08 03:29:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.