Skip to content

Commit 20eddd2

Browse files
authored
DOCS-14979 adds setAllowMigrations command (#239)
* adds setAllowMigrations command * updates 5.2 Release Notes * review * adds refs for sharding-chunk-migration-automatic and sharding-chunk-migration-manual * updates nav and release notes * updates release notes spacing
1 parent ba3d5f9 commit 20eddd2

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

source/core/sharding-data-partitioning.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,14 @@ MongoDB migrates chunks in a :term:`sharded cluster` to distribute the
167167
chunks of a sharded collection evenly among shards. Migrations may be
168168
either:
169169

170+
.. _sharding-chunk-migration-manual:
171+
170172
- Manual. Only use manual migration in limited cases, such as
171173
to distribute data during bulk inserts. See :doc:`Migrating Chunks
172174
Manually </tutorial/migrate-chunks-in-sharded-cluster>` for more details.
173175

176+
.. _sharding-chunk-migration-automatic:
177+
174178
- Automatic. The :ref:`balancer <sharding-balancing>` process
175179
automatically migrates chunks when there is an uneven distribution of
176180
a sharded collection's chunks across the shards. See :ref:`Migration

source/reference/command/nav-sharding.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ Sharding Commands
140140

141141
.. versionadded:: 5.0
142142

143+
* - :dbcommand:`setAllowMigrations`
144+
145+
- Prevents the start of new :ref:`automatic migrations <sharding-chunk-migration-automatic>` on a
146+
collection, prevents in-flight :ref:`manual migrations <sharding-chunk-migration-manual>` from
147+
committing, and excludes the collection from new balancer rounds.
148+
143149
* - :dbcommand:`setShardVersion`
144150

145151
- Internal command to sets the :term:`config server <config database>` version.
@@ -204,6 +210,7 @@ Sharding Commands
204210
/reference/command/removeShard
205211
/reference/command/removeShardFromZone
206212
/reference/command/reshardCollection
213+
/reference/command/setAllowMigrations
207214
/reference/command/setShardVersion
208215
/reference/command/shardCollection
209216
/reference/command/shardingState
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
==================
2+
setAllowMigrations
3+
==================
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
Definition
14+
----------
15+
16+
.. dbcommand:: setAllowMigrations
17+
18+
Prevents the start of new :ref:`automatic migrations
19+
<sharding-chunk-migration-automatic>` on a collection, prevents
20+
in-flight :ref:`manual migrations <sharding-chunk-migration-manual>`
21+
from committing, and excludes the collection from new balancer
22+
rounds.
23+
24+
The command has the following syntax:
25+
26+
.. code-block:: javascript
27+
28+
db.adminCommand( {
29+
setAllowMigrations: "<db>.<collection>",
30+
allowMigrations: <true|false>
31+
} )
32+
33+
The command takes the following parameters:
34+
35+
.. list-table::
36+
:header-rows: 1
37+
:widths: 20 20 60
38+
39+
* - Field
40+
- Type
41+
- Description
42+
43+
* - :ref:`setAllowMigrations <setAllowMigrations-cmd-coll>`
44+
45+
- ``string``
46+
47+
- .. _setAllowMigrations-cmd-coll:
48+
49+
The collection to modify.
50+
51+
* - :ref:`allowMigrations <setAllowMigrations-cmd-flag>`
52+
53+
- ``boolean``
54+
55+
- .. _setAllowMigrations-cmd-flag:
56+
57+
If ``false``:
58+
59+
- MongoDB prevents new :ref:`automatic migrations
60+
<sharding-chunk-migration-automatic>` on the collection
61+
- in-flight :ref:`manual migrations
62+
<sharding-chunk-migration-manual>` will not be committed
63+
- the collection will be excluded from new balancer rounds
64+
65+
If ``true``:
66+
67+
- MongoDB allows new :ref:`automatic migrations
68+
<sharding-chunk-migration-automatic>` on the collection
69+
- in-flight :ref:`manual migrations
70+
<sharding-chunk-migration-manual>` will be committed
71+
- the collection will be included in new balancer rounds
72+
73+
Behavior
74+
--------
75+
76+
:dbcommand:`setAllowMigration` requires the same privileges as
77+
:authaction:`moveChunk`.
78+
79+
Example
80+
-------
81+
82+
This operation prevents migrations on the ``store.inventory``
83+
collection:
84+
85+
.. code-block:: javascript
86+
87+
db.adminCommand( {
88+
setAllowMigrations: "store.inventory",
89+
allowMigrations: false
90+
} )

source/release-notes/5.2.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ Starting in MongoDB 5.2, the
120120
:ref:`default chunk size <sharding-chunk-size>` is 128 megabytes. In
121121
earlier versions of MongoDB, the default chunk size is 64 megabytes.
122122

123+
Prevent Migrations on a Sharded Collection with ``setAllowMigrations``
124+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125+
126+
Starting in MongoDB 5.2, the :dbcommand:`setAllowMigrations` command:
127+
128+
- Prevents the start of new :ref:`automatic migrations
129+
<sharding-chunk-migration-automatic>` on a collection
130+
- Prevents in-flight :ref:`manual migrations
131+
<sharding-chunk-migration-manual>` from committing
132+
- Excludes the collection from new balancer rounds
133+
123134
.. _5.2-rel-notes-general:
124135

125136
General Improvements

0 commit comments

Comments
 (0)