summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/move_primary_source_manager.h
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2018-03-15 17:25:38 -0400
committerBlake Oler <blake.oler@mongodb.com>2018-03-20 17:57:54 -0400
commitda286925e7d072f8b61199df8fb3b196b9059778 (patch)
tree5d553b0be944be9374c5b2d065c1816903e2c043 /src/mongo/db/s/move_primary_source_manager.h
parent2682dbfb28324406f6eded1f22f6e342a392ff13 (diff)
downloadmongo-da286925e7d072f8b61199df8fb3b196b9059778.tar.gz
SERVER-33768 Create a movePrimary critical section on the donor shard (with recovery from crash)
Diffstat (limited to 'src/mongo/db/s/move_primary_source_manager.h')
-rw-r--r--src/mongo/db/s/move_primary_source_manager.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/s/move_primary_source_manager.h b/src/mongo/db/s/move_primary_source_manager.h
index 4c9eb5a63c9..751ebeae0e4 100644
--- a/src/mongo/db/s/move_primary_source_manager.h
+++ b/src/mongo/db/s/move_primary_source_manager.h
@@ -50,6 +50,8 @@ class Status;
* - Acquire a distributed lock on the database whose primary is about to be moved.
* - Instantiate a MovePrimarySourceManager on the stack.
* - Call clone to start and finish cloning of the unsharded collections.
+ * - Call enterCriticalSection to cause the shard to enter in 'read only' mode while the config
+ * server is notified of the new primary.
* - Call updatePrimary to indicate the new primary in the config server metadata.
* - Call clearStaleCollections to drop now-unused collections (and potentially databases) on the
* old primary.
@@ -93,6 +95,16 @@ public:
Status clone(OperationContext* opCtx);
/**
+ * Once this call returns successfully, no writes will be happening on this shard until the
+ * movePrimary is committed. Therefore, commitMovePrimaryMetadata must be called as soon as
+ * possible afterwards.
+ *
+ * Expected state: kCloneCompleted
+ * Resulting state: kCriticalSection on success, kDone on failure
+ */
+ Status enterCriticalSection(OperationContext* opCtx);
+
+ /**
* May be called at any time. Unregisters the movePrimary source manager from the database and
* logs an error in the change log to indicate that the migration has failed.
*