diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2020-03-29 10:52:41 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-10 17:31:40 +0000 |
commit | 7645ff98bb0f289f8eb1605cb743b414e5ded0fc (patch) | |
tree | 10c276e9c6c63d67ba64274ca848e4e85ad7f33b /src/mongo/db/s/scoped_collection_metadata.h | |
parent | bc94db6b53702214da703957606870b771deda7a (diff) | |
download | mongo-7645ff98bb0f289f8eb1605cb743b414e5ded0fc.tar.gz |
SERVER-46703 Make `checkShardVersionOrThrow` throw SSV if the metadata is not known
Introduces a checkShardVersionOKOrThrow_DEPRECATED variant so that we can incrementally fix the places, which are not prepared to catch StaleConfig exceptions.
Diffstat (limited to 'src/mongo/db/s/scoped_collection_metadata.h')
-rw-r--r-- | src/mongo/db/s/scoped_collection_metadata.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mongo/db/s/scoped_collection_metadata.h b/src/mongo/db/s/scoped_collection_metadata.h index def09bbf748..f8eb1b9fd54 100644 --- a/src/mongo/db/s/scoped_collection_metadata.h +++ b/src/mongo/db/s/scoped_collection_metadata.h @@ -34,9 +34,10 @@ namespace mongo { /** - * Acts like a shared pointer and exposes sharding filtering metadata to be used by server - * operations. It is allowed to be referenced outside of collection lock, but all implementations - * must be able to outlive the object from which they were obtained. + * Contains the parts of the sharding state for a particular collection, which do not change due to + * chunk move, split and merge. The implementation is allowed to be tighly coupled with the + * CollectionShardingState from which it was derived and because of this it must not be accessed + * outside of a collection lock. */ class ScopedCollectionDescription { public: @@ -108,11 +109,17 @@ public: return _impl->get().getChunkManager()->getShardKeyPattern().extractShardKeyFromDoc(doc); } - protected: std::shared_ptr<Impl> _impl; }; +/** + * Contains the parts of the sharding state for a particular collection, which can change due to + * chunk move, split and merge and represents a snapshot in time of these parts, specifically the + * chunk ownership. The implementation is allowed to be tightly coupled with the + * CollectionShardingState from which it was derived, but it must be allowed to be accessed outside + * of collection lock. + */ class ScopedCollectionFilter : public ScopedCollectionDescription { public: ScopedCollectionFilter(std::shared_ptr<Impl> impl) |