diff options
author | Dan Larkin-York <dan.larkin-york@mongodb.com> | 2022-01-22 03:41:25 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-22 04:12:24 +0000 |
commit | 76c8ef928e6eb764a6bc4c32b0165b2de7b89d63 (patch) | |
tree | 9a7d4a1746113a7a381419b6a5f54fa56dcedf87 /src/mongo/db/catalog/collection_compact.cpp | |
parent | 756c5d68190d2bbc6484e94ac78d4b8449503837 (diff) | |
download | mongo-76c8ef928e6eb764a6bc4c32b0165b2de7b89d63.tar.gz |
SERVER-53307 Make ViewCatalog global
Diffstat (limited to 'src/mongo/db/catalog/collection_compact.cpp')
-rw-r--r-- | src/mongo/db/catalog/collection_compact.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mongo/db/catalog/collection_compact.cpp b/src/mongo/db/catalog/collection_compact.cpp index da74618fc1a..9a5cb25d52a 100644 --- a/src/mongo/db/catalog/collection_compact.cpp +++ b/src/mongo/db/catalog/collection_compact.cpp @@ -51,7 +51,6 @@ using logv2::LogComponent; namespace { CollectionPtr getCollectionForCompact(OperationContext* opCtx, - Database* database, const NamespaceString& collectionNss) { invariant(opCtx->lockState()->isCollectionLockedForMode(collectionNss, MODE_IX)); @@ -60,7 +59,7 @@ CollectionPtr getCollectionForCompact(OperationContext* opCtx, if (!collection) { std::shared_ptr<const ViewDefinition> view = - ViewCatalog::get(database)->lookup(opCtx, collectionNss); + ViewCatalog::get(opCtx)->lookup(opCtx, collectionNss); uassert(ErrorCodes::CommandNotSupportedOnView, "can't compact a view", !view); uasserted(ErrorCodes::NamespaceNotFound, "collection does not exist"); } @@ -81,7 +80,7 @@ StatusWith<int64_t> compactCollection(OperationContext* opCtx, boost::optional<Lock::CollectionLock> collLk; collLk.emplace(opCtx, collectionNss, MODE_X); - CollectionPtr collection = getCollectionForCompact(opCtx, database, collectionNss); + CollectionPtr collection = getCollectionForCompact(opCtx, collectionNss); DisableDocumentValidation validationDisabler(opCtx); auto recordStore = collection->getRecordStore(); @@ -99,7 +98,7 @@ StatusWith<int64_t> compactCollection(OperationContext* opCtx, collLk.emplace(opCtx, collectionNss, MODE_IX); // Ensure the collection was not dropped during the re-lock. - collection = getCollectionForCompact(opCtx, database, collectionNss); + collection = getCollectionForCompact(opCtx, collectionNss); recordStore = collection->getRecordStore(); } |