diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-09-17 17:09:19 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-26 02:12:49 +0000 |
commit | 2b82ab88982566114d1bb7667477b71c883b0799 (patch) | |
tree | c152b35ff047fdc42f69aa6cd6b04fee1d811fe4 /src/mongo/db/index/index_access_method.h | |
parent | 08e92a678a1ed288f6a95e7950597e082556ae59 (diff) | |
download | mongo-2b82ab88982566114d1bb7667477b71c883b0799.tar.gz |
SERVER-50984 Add CollectionPtr to replace usage of const Collection*
It implements a yieldable interface that is used to re-load the
Collection pointer from the catalog after a yield that released locks.
With lock-free reads and copy-on-write on Collection instances releasing
locks without notifying an AutoGetCollection at a higher level may cause
its pointers to dangle if a MODE_X writer installs a new Collection
instance in the catalog.
CollectionPtr should be passed by const reference so a yield can notify
all the way up.
Diffstat (limited to 'src/mongo/db/index/index_access_method.h')
-rw-r--r-- | src/mongo/db/index/index_access_method.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/db/index/index_access_method.h b/src/mongo/db/index/index_access_method.h index 3d57dcb901a..15d32be7f1b 100644 --- a/src/mongo/db/index/index_access_method.h +++ b/src/mongo/db/index/index_access_method.h @@ -87,7 +87,7 @@ public: * The behavior of the insertion can be specified through 'options'. */ virtual Status insert(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const BSONObj& obj, const RecordId& loc, const InsertDeleteOptions& options, @@ -100,7 +100,7 @@ public: * multikey in the catalog, and sets the path-level multikey information if applicable. */ virtual Status insertKeysAndUpdateMultikeyPaths(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const KeyStringSet& keys, const KeyStringSet& multikeyMetadataKeys, const MultikeyPaths& multikeyPaths, @@ -114,7 +114,7 @@ public: * insertion of these keys should cause the index to become multikey. */ virtual Status insertKeys(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const KeyStringSet& keys, const RecordId& loc, const InsertDeleteOptions& options, @@ -155,7 +155,7 @@ public: * 'numDeleted' will be set to the number of keys removed from the index for the document. */ virtual Status update(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const UpdateTicket& ticket, int64_t* numInserted, int64_t* numDeleted) = 0; @@ -215,7 +215,7 @@ public: * Sets this index as multikey with the provided paths. */ virtual void setIndexIsMultikey(OperationContext* opCtx, - const Collection* collection, + const CollectionPtr& collection, KeyStringSet multikeyMetadataKeys, MultikeyPaths paths) = 0; @@ -454,7 +454,7 @@ public: std::unique_ptr<SortedDataInterface> btree); Status insert(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const BSONObj& obj, const RecordId& loc, const InsertDeleteOptions& options, @@ -462,7 +462,7 @@ public: int64_t* numInserted) final; Status insertKeys(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const KeyStringSet& keys, const RecordId& loc, const InsertDeleteOptions& options, @@ -470,7 +470,7 @@ public: int64_t* numInserted) final; Status insertKeysAndUpdateMultikeyPaths(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const KeyStringSet& keys, const KeyStringSet& multikeyMetadataKeys, const MultikeyPaths& multikeyPaths, @@ -494,7 +494,7 @@ public: UpdateTicket* ticket) const final; Status update(OperationContext* opCtx, - const Collection* coll, + const CollectionPtr& coll, const UpdateTicket& ticket, int64_t* numInserted, int64_t* numDeleted) final; @@ -520,7 +520,7 @@ public: Status compact(OperationContext* opCtx) final; void setIndexIsMultikey(OperationContext* opCtx, - const Collection* collection, + const CollectionPtr& collection, KeyStringSet multikeyMetadataKeys, MultikeyPaths paths) final; |