From 49c2270bd963894f0e1a201f5cbe9ef2fd1eb329 Mon Sep 17 00:00:00 2001 From: Joanna Cheng Date: Thu, 13 Oct 2016 18:05:19 +1100 Subject: [PATCH 1/2] Added warning about movePrimary command --- source/includes/warning-movePrimary.rst | 13 +++++++++++++ source/reference/command/movePrimary.txt | 18 +----------------- source/tutorial/remove-shards-from-cluster.txt | 2 ++ 3 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 source/includes/warning-movePrimary.rst diff --git a/source/includes/warning-movePrimary.rst b/source/includes/warning-movePrimary.rst new file mode 100644 index 00000000000..22cf916437a --- /dev/null +++ b/source/includes/warning-movePrimary.rst @@ -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 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. diff --git a/source/reference/command/movePrimary.txt b/source/reference/command/movePrimary.txt index 0d83112a3b0..16951efe81f 100644 --- a/source/reference/command/movePrimary.txt +++ b/source/reference/command/movePrimary.txt @@ -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 @@ -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 ---------------------- diff --git a/source/tutorial/remove-shards-from-cluster.txt b/source/tutorial/remove-shards-from-cluster.txt index 921e09b5d94..d7cba87b293 100644 --- a/source/tutorial/remove-shards-from-cluster.txt +++ b/source/tutorial/remove-shards-from-cluster.txt @@ -177,6 +177,8 @@ primary shards.) { "primary" : "mongodb1", "ok" : 1 } +.. include:: /includes/warning-movePrimary.rst + .. _remove-shard-finalize-migration: Finalize the Migration From 983535d28c0cc5919ec920c80bc56110afd97729 Mon Sep 17 00:00:00 2001 From: Joanna Cheng Date: Thu, 27 Oct 2016 14:38:56 +1100 Subject: [PATCH 2/2] Fixed wording for clarity. --- source/includes/warning-movePrimary.rst | 10 +++++----- source/tutorial/remove-shards-from-cluster.txt | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/includes/warning-movePrimary.rst b/source/includes/warning-movePrimary.rst index 22cf916437a..ec116011ebc 100644 --- a/source/includes/warning-movePrimary.rst +++ b/source/includes/warning-movePrimary.rst @@ -3,11 +3,11 @@ 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. + :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. + on reads, and may not write data to the correct shard. To recover, you must + manually intervene. diff --git a/source/tutorial/remove-shards-from-cluster.txt b/source/tutorial/remove-shards-from-cluster.txt index d7cba87b293..938dc5569a4 100644 --- a/source/tutorial/remove-shards-from-cluster.txt +++ b/source/tutorial/remove-shards-from-cluster.txt @@ -177,7 +177,11 @@ primary shards.) { "primary" : "mongodb1", "ok" : 1 } -.. include:: /includes/warning-movePrimary.rst +.. warning:: + + The :dbcommand:`movePrimary` command has many considerations, please + carefully review the documentation to ensure that these are correctly + handled. .. _remove-shard-finalize-migration: