diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-10-06 18:08:33 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-10-07 19:32:48 -0400 |
commit | 30b79f47f04926d972192ed06a1fa08620592b67 (patch) | |
tree | 1151621aa76508eb6b16ea5bb0a9bca18ac72d15 /src/mongo/db/s/migration_source_manager.h | |
parent | 9f496a34f46adec73ed6da49b869c169c2a70519 (diff) | |
download | mongo-30b79f47f04926d972192ed06a1fa08620592b67.tar.gz |
SERVER-26471 Always incrementally refresh metadata after committing chunk migration
Also introduces a failpoint and js test to exercise the race condition.
Diffstat (limited to 'src/mongo/db/s/migration_source_manager.h')
-rw-r--r-- | src/mongo/db/s/migration_source_manager.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mongo/db/s/migration_source_manager.h b/src/mongo/db/s/migration_source_manager.h index 99ce842cdbd..2d78182a218 100644 --- a/src/mongo/db/s/migration_source_manager.h +++ b/src/mongo/db/s/migration_source_manager.h @@ -113,7 +113,8 @@ public: /** * Waits for the active clone operation to catch up and enters critical section. Once this call * returns successfully, no writes will be happening on this shard until the chunk donation is - * committed. Therefore, commitDonateChunk must be called as soon as possible after it. + * committed. Therefore, commitChunkOnRecipient/commitChunkMetadata must be called as soon as + * possible afterwards. * * Expected state: kCloneCaughtUp * Resulting state: kCriticalSection on success, kDone on failure @@ -121,6 +122,14 @@ public: Status enterCriticalSection(OperationContext* txn); /** + * Tells the recipient of the chunk to commit the chunk contents, which it received. + * + * Expected state: kCriticalSection + * Resulting state: kCloneCompleted on success, kDone on failure + */ + Status commitChunkOnRecipient(OperationContext* txn); + + /** * Tells the recipient shard to fetch the latest portion of data from the donor and to commit it * locally. After that it persists the changed metadata to the config servers and leaves the * critical section. @@ -129,10 +138,10 @@ public: * applying the committed chunk information fails and we cannot definitely verify that the * write was definitely applied or not, this call may crash the server. * - * Expected state: kCriticalSection + * Expected state: kCloneCompleted * Resulting state: kDone */ - Status commitDonateChunk(OperationContext* txn); + Status commitChunkMetadataOnConfig(OperationContext* txn); /** * May be called at any time. Unregisters the migration source manager from the collection, @@ -182,7 +191,7 @@ public: private: // Used to track the current state of the source manager. See the methods above, which have // comments explaining the various state transitions. - enum State { kCreated, kCloning, kCloneCaughtUp, kCriticalSection, kDone }; + enum State { kCreated, kCloning, kCloneCaughtUp, kCriticalSection, kCloneCompleted, kDone }; /** * Called when any of the states fails. May only be called once and will put the migration |