Skip to content

Commit 3052444

Browse files
DOCSP-12324 doc for killOp command (#76)
* DOCSP-12324 doc for killOp command * DOCSP-12324 updates for copy review feedback * DOCSP-12324 updates for tech review feedback
1 parent c8d677f commit 3052444

File tree

3 files changed

+109
-6
lines changed

3 files changed

+109
-6
lines changed

source/admin/determine-query-status.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ documents with the following fields:
5050
- string
5151
- Type of operation. Value is always ``op``.
5252

53+
* - ``$currentOp.opid``
54+
- :manual:`ObjectId </reference/bson-types/#objectid>`
55+
- Unique identifier of the operation in :manual:`ObjectId
56+
</reference/bson-types/#objectid>` format.
57+
5358
* - ``$currentOp.client``
5459
- string
5560
- IP address (or hostname) and the ephemeral port of the client
@@ -58,10 +63,10 @@ documents with the following fields:
5863
* - ``$currentOp.clientMetadata``
5964
- Document
6065
- Additional client information such as the client:
61-
.. container::
62-
- Application name
63-
- Driver name and version number
64-
- Operating System name, type, architecture, and version number
66+
67+
- Application name
68+
- Driver name and version
69+
- Operating system name, type, architecture, and version
6570

6671
* - ``$currentOp.active``
6772
- boolean
@@ -113,8 +118,8 @@ For the example below, suppose the following query is being run on the
113118

114119
db.airbnb.find( { "address.market" : "Porto", "review_scores.review_scores_rating": {$gt: 79}})
115120

116-
The following example returns information on the previous query being run on the
117-
``airbnb`` collection in the ``sample`` database:
121+
The following example returns information on the previous query running on
122+
the ``airbnb`` collection in the ``sample`` database:
118123

119124
.. code-block:: json
120125

@@ -130,6 +135,7 @@ processed at the time that ``$currentOp`` was run.
130135

131136
{
132137
"type" : "op",
138+
"opid" : ObjectId("1635fa35bf73f4320c6f99d0"),
133139
"client" : "73.231.201.205:62351",
134140
"clientMetadata" : {
135141
"application" : {
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
.. _terminate-running-query:
2+
3+
=============================================
4+
Terminate a Running {+data-lake-short+} Query
5+
=============================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
You can terminate long-running queries using the :manual:`killOp
16+
</reference/command/killOp/>` command. For more information, see
17+
:manual:`killOp </reference/command/killOp/>`. In {+adl+}:
18+
19+
- The ``op`` parameter value is an :manual:`ObjectId
20+
</reference/bson-types/#objectid>`.
21+
- The ``comment`` parameter is not supported.
22+
23+
Only the user who issued the query can terminate the query. To run
24+
this command, use :manual:`db.runCommand()
25+
</reference/method/db.runCommand>`. You must run :manual:`killOp
26+
</reference/command/killOp/>` against the ``admin`` database.
27+
28+
.. _adl-killop-syntax:
29+
30+
Syntax
31+
------
32+
33+
.. code-block:: json
34+
35+
db.runCommand([{ "killOp": 1, "op": ObjectId(<hexadecimal>) }])
36+
37+
.. _adl-killop-options:
38+
39+
Options
40+
-------
41+
42+
.. list-table::
43+
:header-rows: 1
44+
:widths: 15 15 60 10
45+
46+
* - Field
47+
- Type
48+
- Description
49+
- Necessity
50+
51+
* - ``op``
52+
- :manual:`ObjectId </reference/bson-types/#objectid>`
53+
- Unique identifier, in :manual:`ObjectId
54+
</reference/bson-types/#objectid>` format, of the operation
55+
to terminate. You can use :ref:`$currentOp
56+
<determine-query-status>` to retrieve the ``opid`` of the
57+
operation to terminate.
58+
- Required
59+
60+
.. _adl-killop-output:
61+
62+
Output
63+
------
64+
65+
:manual:`killOp </reference/command/killOp/>` returns the following
66+
if it succeeds in marking the specified operation for termination:
67+
68+
.. code-block::
69+
:copyable: false
70+
71+
{ "info" : "attempting to kill op", "ok" : 1 }
72+
73+
Note that the output is the same whether or not the operation being
74+
terminated is currently running. You can use :ref:`$currentOp
75+
<determine-query-status>` to verify that the operation was terminated.
76+
77+
.. _adl-killop-egs:
78+
79+
Examples
80+
--------
81+
82+
For the example below, suppose a query with ``opid`` value of
83+
``ObjectId("1635fad364c529820c6f9e76")`` is running. The following
84+
command terminates this query.
85+
86+
.. code-block:: json
87+
88+
use admin
89+
db.runCommand({ "killOp": 1, "op": ObjectId("1635fad364c529820c6f9e76") })
90+
91+
The previous command returns the following:
92+
93+
.. code-block:: json
94+
:copyable: false
95+
96+
{ "info" : "attempting to kill op", "ok" : 1 }

source/query/query-data-lake.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,4 @@ results.
275275

276276
/admin/optimize-query-performance
277277
/admin/determine-query-status
278+
/admin/terminate-running-query

0 commit comments

Comments
 (0)