-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
cleanupOrphaned.txt
137 lines (91 loc) · 3.12 KB
/
cleanupOrphaned.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
===============
cleanupOrphaned
===============
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
.. important::
Starting in MongoDB 6.0.3, you should run an aggregation using the
:pipeline:`$shardedDataDistribution` stage to confirm no orphaned
documents remain. For details,
see :ref:`shardedDataDistribution-no-orphaned-docs`.
Definition
----------
.. dbcommand:: cleanupOrphaned
.. deprecated:: 8.0
Use this command to wait for orphaned documents in a chunk
range from a shard key's :bsontype:`MinKey` to its
:bsontype:`MaxKey` for a specified namespace to be
cleaned up from a majority of a shard's members.
To run, issue ``cleanupOrphaned`` in the ``admin`` database
directly on the :binary:`~bin.mongod` instance that is the primary
replica set member of the shard. You do not need to disable the
balancer before running ``cleanupOrphaned``.
.. note::
Do not run ``cleanupOrphaned`` on a
:binary:`~bin.mongos` instance.
Compatibility
-------------
This command is available in deployments hosted in the following environments:
.. include:: /includes/fact-environments-atlas-only.rst
.. include:: /includes/fact-environments-atlas-support-no-free.rst
.. include:: /includes/fact-environments-onprem-only.rst
Syntax
------
The command has the following syntax:
.. code-block:: javascript
db.runCommand(
{
cleanupOrphaned: "<database>.<collection>",
startingFromKey: <minimumShardKeyValue>, // deprecated
secondaryThrottle: <boolean>, // deprecated
writeConcern: <document> // deprecated
}
)
Command Fields
~~~~~~~~~~~~~~
``cleanupOrphaned`` has the following fields:
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Field
- Type
- Description
* - ``cleanupOrphaned``
- string
- The namespace, i.e. both the database and the collection name,
of the sharded collection for which to wait for cleanup of the
orphaned data.
Behavior
--------
.. _cleanupOrphaned-determine-range:
Determine Range
~~~~~~~~~~~~~~~
The value of this field is not used to determine the bounds of the cleanup
range. The ``cleanupOrphaned`` command waits until all orphaned
documents in all ranges in the namespace are cleaned up from the shard before
completing, regardless of the presence of or value of
``startingFromKey``.
Required Access
---------------
On systems running with :setting:`~security.authorization`, you must have
:authrole:`clusterAdmin` privileges to run ``cleanupOrphaned``.
.. _cleanupOrphaned-output:
Output
------
Return Document
~~~~~~~~~~~~~~~
Each ``cleanupOrphaned`` command returns a document containing
a subset of the following fields:
.. data:: cleanupOrphaned.ok
Equal to ``1`` on success.
A value of ``1`` indicates that either:
- No orphaned documents remain in the ``cleanupOrphaned`` namespace
on the shard, or
- The collection referenced in the ``cleanupOrphaned`` namespace is
not sharded.
A value of ``0`` indicates that an error has occurred.
.. admin-only