diff options
Diffstat (limited to 'src/mongo/db/s/migration_destination_manager.h')
-rw-r--r-- | src/mongo/db/s/migration_destination_manager.h | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/src/mongo/db/s/migration_destination_manager.h b/src/mongo/db/s/migration_destination_manager.h index c42ce1cdcb2..fd5c897ea6a 100644 --- a/src/mongo/db/s/migration_destination_manager.h +++ b/src/mongo/db/s/migration_destination_manager.h @@ -70,6 +70,13 @@ public: void setState(State newState); /** + * These log the argument msg; then, under lock, move msg to _errmsg and set the state to FAIL. + * The setStateWailWarn version logs with "warning() << msg". + */ + void setStateFail(std::string msg); + void setStateFailWarn(std::string msg); + + /** * Checks whether the MigrationDestinationManager is currently handling a migration. */ bool isActive() const; @@ -150,35 +157,17 @@ private: /** * Remembers a chunk range between 'min' and 'max' as a range which will have data migrated - * into it. This data can then be protected against cleanup of orphaned data. - * - * Overlapping pending ranges will be removed, so it is only safe to use this when you know - * your metadata view is definitive, such as at the start of a migration. - * - * TODO: Because migrations may currently be active when a collection drops, an epoch is - * necessary to ensure the pending metadata change is still applicable. + * into it, to protect it against separate commands to clean up orphaned data. First, though, + * it schedules deletion of any documents in the range, so that process must be seen to be + * complete before migrating any new documents in. */ - Status _notePending(OperationContext* opCtx, - const NamespaceString& nss, - const BSONObj& min, - const BSONObj& max, - const OID& epoch); + Status _notePending(OperationContext*, NamespaceString const&, OID const&, ChunkRange const&); /** * Stops tracking a chunk range between 'min' and 'max' that previously was having data - * migrated into it. This data is no longer protected against cleanup of orphaned data. - * - * To avoid removing pending ranges of other operations, ensure that this is only used when - * a migration is still active. - * - * TODO: Because migrations may currently be active when a collection drops, an epoch is - * necessary to ensure the pending metadata change is still applicable. + * migrated into it, and schedules deletion of any such documents already migrated in. */ - Status _forgetPending(OperationContext* opCtx, - const NamespaceString& nss, - const BSONObj& min, - const BSONObj& max, - const OID& epoch); + void _forgetPending(OperationContext*, NamespaceString const&, OID const&, ChunkRange const&); /** * Checks whether the MigrationDestinationManager is currently handling a migration by checking |