Skip to content

Commit c205161

Browse files
(DOCS-15063): Change to balancerCollectionStatus output (#2085)
* (DOCS-15063): Update balancerCollectionStatus command page * more updates * edits * small edits * tweak * wording * add details per tech review * formatting - note
1 parent fa09043 commit c205161

File tree

7 files changed

+93
-24
lines changed

7 files changed

+93
-24
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
If the queried namespace is going through chunk defragmentation, the
2+
|balancer-command| returns output similar to the following:
3+
4+
.. code-block:: javascript
5+
:copyable: false
6+
7+
{
8+
"balancerCompliant": false,
9+
"firstComplianceViolation": "defragmentingChunks",
10+
"details": {
11+
"currentPhase": "moveAndMergeChunks",
12+
"progress": { "remainingChunksToProcess": 1 }
13+
}
14+
}
15+
16+
.. note::
17+
18+
Chunk defragmentation occurs in multiple phases. The ``progress`` field
19+
only pertains to the current phase.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Starting in MongoDB 5.3, the :dbcommand:`balancerCollectionStatus`
2+
command returns detailed information when run on a namespace going
3+
through chunk defragmentation. The output includes the current phase of
4+
the defragmentation and how many chunks are left to process.
5+
6+
To see example output, see
7+
:ref:`balancer-collection-status-defrag-output-command`.

source/reference/command/balancerCollectionStatus.txt

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ The following is an example of a document returned by the command:
9999

100100
* - ``"firstComplianceViolation"``
101101

102-
- A string that indicates the reason chunks for this namespace need to be
103-
moved. The field is only available if ``"balancerCompliant"`` is
104-
``false``.
102+
- A string that indicates the reason chunks for this namespace need
103+
to be moved. The field is only available if
104+
``"balancerCompliant"`` is ``false``.
105105

106106
Possible values are:
107107

@@ -112,43 +112,55 @@ The following is an example of a document returned by the command:
112112
* - Value
113113
- Description
114114

115+
* - ``"chunksImbalance"``
116+
117+
- The difference in the number of chunks between the shard
118+
with the most chunks for the collection and the shard
119+
with the fewest chunks for the collection exceed the
120+
:ref:`migration threshold<sharding-migration-thresholds>`.
121+
122+
* - ``"defragmentingChunks"``
123+
124+
- The queried namespace is currently going through the chunk
125+
defragmentation process. Defragmentation can be triggered
126+
by the :dbcommand:`configureCollectionBalancing` command.
127+
115128
* - ``"draining"``
116129

117130
- A :ref:`remove shard operation
118131
<remove-shard-remove-chunks>` is in progress and MongoDB
119132
must drain chunks off the removed shard to other shard(s).
120133

121-
.. note::
122-
123-
If the ``"firstComplianceViolation"`` returns
124-
``"draining"``, there may also be pending chunk
125-
migration due to ``"zoneViolation"``.
126-
127134
* - ``"zoneViolation"``
128135

129136
- Chunks violate the :ref:`defined zone ranges
130137
<zone-sharding-balancer>` for a shard.
131138

132-
.. note::
139+
.. note::
133140

134-
If the ``"firstComplianceViolation"`` responds with
135-
``"zoneViolation"``, there may also be pending chunk
136-
migrations due to ``"chunksImbalance"``.
141+
This field only returns information on the *first* violation
142+
observed by MongoDB. There may be additional pending chunk
143+
migrations due to a different reason than the one reported in
144+
``firstComplianceViolation``.
137145

138-
* - ``"chunksImbalance"``
139-
140-
- The difference in the number of chunks between the shard
141-
with the most chunks for the collection and the shard
142-
with the fewest chunks for the collection exceed the
143-
:ref:`migration threshold<sharding-migration-thresholds>`.
146+
* - ``"details"``
147+
148+
- An object containing information on the ongoing defragmentation
149+
process. This object indicates the current phase of the
150+
defragmentation and how many chunks are left to process in that
151+
phase. For example output, see
152+
:ref:`balancer-collection-status-defrag-output-command`.
153+
154+
This field is only returned when ``firstComplianceViolation`` is
155+
``defragmentingChunks``.
144156

145157
In addition to the command-specific return fields, the command also
146158
returns the ``ok`` status field, the ``operationTime`` field, and the
147159
``$clusterTime`` field for the operation. For details on these fields,
148160
see :ref:`command-response`.
149161

150-
Example
151-
-------
162+
Examples
163+
--------
152164

153165
To check whether the chunks of a sharded collection ``test.contacts``
154166
is currently in balance, connect to a :binary:`~bin.mongos` instance
@@ -177,3 +189,11 @@ returns an output similar to the following:
177189
}
178190
}
179191

192+
.. _balancer-collection-status-defrag-output-command:
193+
194+
Ongoing Defragmentation Process
195+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
196+
197+
.. |balancer-command| replace:: ``balancerCollectionStatus`` command
198+
199+
.. include:: /includes/sharding/balancer-status-defrag-example.rst

source/reference/command/configureCollectionBalancing.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ To tell the balancer to defragment a sharded collection, use the
128128
} )
129129

130130
Use this command to have the balancer defragment a sharded collection.
131+
To monitor the chunk defragmentation process, use the
132+
:dbcommand:`balancerCollectionStatus` command.
131133

132134
Reconfigure and Defragment Collections
133135
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -143,4 +145,3 @@ together:
143145
chunkSize: 512,
144146
defragmentCollection: true
145147
} )
146-

source/reference/method/sh.balancerCollectionStatus.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ The built-in :authrole:`clusterManager` role provides the appropriate
7575
privileges.
7676

7777

78-
Example
79-
-------
78+
Examples
79+
--------
8080

8181
To check whether the chunks of a sharded collection ``test.contacts``
8282
is currently in balance, connect to a :binary:`~bin.mongos` instance
@@ -105,5 +105,14 @@ returns an output similar to the following:
105105
}
106106
}
107107

108+
.. _balancer-collection-status-defrag-output-method:
109+
110+
Ongoing Defragmentation Process
111+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112+
113+
.. |balancer-command| replace:: ``sh.balancerCollectionStatus`` method
114+
115+
.. include:: /includes/sharding/balancer-status-defrag-example.rst
116+
108117
For the description of the output, see :ref:`balancerCollectionStatus
109118
Output <cmd-balancer-CollectionStatus-output>`.

source/release-notes/5.3.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,20 @@ for active keys.
128128
Sharding
129129
--------
130130

131+
Limit Rate of Splits and Merges
132+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133+
131134
Starting in MongoDB 5.3, you can use the new
132135
:parameter:`chunkDefragmentationThrottlingMS` parameter to limit the
133136
rate of split and merge commands run by the :term:`balancer` when the
134137
:term:`chunks <chunk>` in a :term:`sharded <sharding>` collection are
135138
defragmented.
136139

140+
Monitor Defragmentation Status
141+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142+
143+
.. include:: /includes/sharding/balancer-status-defrag-release-notes.rst
144+
137145
.. _5.3-rel-notes-general:
138146

139147
General Improvements

source/release-notes/6.0.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ earlier versions of MongoDB, the default chunk size is 64 megabytes.
371371
Starting in MongoDB 6.0, the :dbcommand:`enableSharding` command is
372372
no longer required to shard a collection.
373373

374+
Monitor Defragmentation Status
375+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
376+
377+
.. include:: /includes/sharding/balancer-status-defrag-release-notes.rst
378+
374379
.. _6.0-rel-notes-sbe:
375380

376381
Slot-Based Query Execution Engine

0 commit comments

Comments
 (0)