Skip to content

DOCS-8540 #2747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions source/includes/warning-movePrimary.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. warning::

If you use the :dbcommand:`movePrimary` command to move un-sharded
collections, you must either restart all :program:`mongos` instances,
or use the :dbcommand:`flushRouterConfig` command on all
:program:`mongos` instances before reading or writing any data to any
unsharded collections that were moved. This action ensures that the
:program:`mongos` is aware of the new shard for these collections.

If you do not update the :program:`mongos` instances' metadata cache
after using :dbcommand:`movePrimary`, the :program:`mongos` may miss data
on reads, and may not write data to the correct shard. To recover, you must
manually intervene.
18 changes: 1 addition & 17 deletions source/reference/command/movePrimary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ movePrimary
Considerations
--------------

Behavior
~~~~~~~~
.. include:: /includes/warning-movePrimary.rst

Avoid accessing an un-sharded collection during migration.
:dbcommand:`movePrimary` does not prevent reading and writing during its
Expand All @@ -62,21 +61,6 @@ conflicting collection name. This may occur if documents are written to an
un-sharded collection while the collection is moved away, and later the original
primary shard is restored.

Use
~~~

If you use the :dbcommand:`movePrimary` command to move un-sharded
collections, you must either restart all :program:`mongos` instances,
or use the :dbcommand:`flushRouterConfig` command on all
:program:`mongos` instances before reading or writing writing any data to the
database that was moved. This action notifies the :program:`mongos` of the new shard
for the database.

If you do not update the :program:`mongos` instances' metadata cache
after using :dbcommand:`movePrimary`, the :program:`mongos` may miss data
on reads, and may not write data to the correct shard. To recover, you must manually
intervene.

Additional Information
----------------------

Expand Down
6 changes: 6 additions & 0 deletions source/tutorial/remove-shards-from-cluster.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ primary shards.)

{ "primary" : "mongodb1", "ok" : 1 }

.. warning::

The :dbcommand:`movePrimary` command has many considerations, please
carefully review the documentation to ensure that these are correctly
handled.

.. _remove-shard-finalize-migration:

Finalize the Migration
Expand Down