diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-07-10 14:21:57 -0400 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-07-10 19:38:01 -0400 |
commit | 3b1554c77ce9c80b30044654ff2cab3aff7070d4 (patch) | |
tree | efbcf847f86b37349d51dfe91414e7312ae02172 /src/mongo/s/catalog_cache.h | |
parent | a13467bddf585a6265e09319f1f769fc0e60beb0 (diff) | |
download | mongo-3b1554c77ce9c80b30044654ff2cab3aff7070d4.tar.gz |
SERVER-29745 after a successful migration, ensure the metadata update is persisted before range deletion is schedule
Diffstat (limited to 'src/mongo/s/catalog_cache.h')
-rw-r--r-- | src/mongo/s/catalog_cache.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h index a978642c825..9b261de3a43 100644 --- a/src/mongo/s/catalog_cache.h +++ b/src/mongo/s/catalog_cache.h @@ -98,6 +98,24 @@ public: const ChunkVersion& version); /** + * Waits for the persisted collection version to be gte to 'version', or an epoch change. Only + * call this function if you KNOW that a version gte WILL eventually be persisted. + * + * This function cannot wait for a version if nothing is persisted because a collection can + * become unsharded after we start waiting and 'version' will then never be reached. If 'nss' + * has no persisted metadata, even if it will shortly, a NamespaceNotFound error will be + * returned. + * + * A lock must not be held when calling this because it would prevent using the latest snapshot + * and actually seeing the change after it arrives. + * This function can throw a DBException if the opCtx is interrupted. + * This can only be called on a shard! + */ + Status waitForCollectionVersion(OperationContext* opCtx, + const NamespaceString& nss, + const ChunkVersion& version); + + /** * Retrieves the cached metadata for the specified database. The returned value is still owned * by the cache and should not be kept elsewhere. I.e., it should only be used as a local * variable. The reason for this is so that if the cache gets invalidated, the caller does not |