diff options
Diffstat (limited to 'src/mongo/db/s/move_primary_source_manager.h')
| -rw-r--r-- | src/mongo/db/s/move_primary_source_manager.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/mongo/db/s/move_primary_source_manager.h b/src/mongo/db/s/move_primary_source_manager.h index cd678c95b19..42586f9d102 100644 --- a/src/mongo/db/s/move_primary_source_manager.h +++ b/src/mongo/db/s/move_primary_source_manager.h @@ -70,10 +70,10 @@ public: * Instantiates a new movePrimary source manager. Must be called with the distributed lock * acquired in advance (not asserted). * - * May throw any exception. Known exceptions (TODO) are: + * May throw any exception. Known exceptions are: * - InvalidOptions if the operation context is missing database version - * - StaleConfigException if the expected database version does not match what we find it - * to be after acquiring the distributed lock. + * - StaleConfig if the expected database version does not match what we find it to be after + * acquiring the distributed lock */ MovePrimarySourceManager(OperationContext* opCtx, @@ -145,10 +145,20 @@ private: } /** - * Updates CSRS metadata in config.databases collection to move the given primary database on - * its new shard. + * Invokes the _configsvrCommitMovePrimary command of the config server to reassign the primary + * shard of the database. */ - Status _commitOnConfig(OperationContext* opCtx); + Status _commitOnConfig(OperationContext* opCtx, const DatabaseVersion& expectedDbVersion); + + /** + * Updates the config server's metadata in config.databases collection to reassign the primary + * shard of the database. + * + * This logic is not synchronized with the removeShard command and simultaneous invocations of + * movePrimary and removeShard can lead to data loss. + */ + Status _fallbackCommitOnConfig(OperationContext* opCtx, + const DatabaseVersion& expectedDbVersion); // Used to track the current state of the source manager. See the methods above, which have // comments explaining the various state transitions. |
