From 2a5b59c4fd6d4182f81755ebd1ff755dd88db6e9 Mon Sep 17 00:00:00 2001 From: Benety Goh Date: Thu, 24 Feb 2022 14:49:45 -0500 Subject: SERVER-62006 inline DurableCatalog::isFeatureDocument() --- src/mongo/db/storage/durable_catalog.h | 14 +++++++++++++- src/mongo/db/storage/durable_catalog_impl.cpp | 9 --------- src/mongo/db/storage/durable_catalog_impl.h | 3 --- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/mongo/db/storage/durable_catalog.h b/src/mongo/db/storage/durable_catalog.h index 4a5c4e893c7..089b7c4f84c 100644 --- a/src/mongo/db/storage/durable_catalog.h +++ b/src/mongo/db/storage/durable_catalog.h @@ -53,6 +53,8 @@ protected: DurableCatalog() = default; public: + static constexpr auto kIsFeatureDocumentFieldName = "isFeatureDoc"_sd; + /** * `Entry` ties together the common identifiers of a single `_mdb_catalog` document. */ @@ -71,6 +73,17 @@ public: return opCtx->getServiceContext()->getStorageEngine()->getCatalog(); } + /** + * Allows featureDocuments to be checked with older versions. + */ + static bool isFeatureDocument(const BSONObj& obj) { + BSONElement firstElem = obj.firstElement(); + if (firstElem.fieldNameStringData() == kIsFeatureDocumentFieldName) { + return firstElem.booleanSafe(); + } + return false; + } + virtual void init(OperationContext* opCtx) = 0; virtual std::vector getAllCatalogEntries(OperationContext* opCtx) const = 0; @@ -224,7 +237,6 @@ public: StringData indexName, MultikeyPaths* multikeyPaths) const = 0; - virtual void setRand_forTest(const std::string& rand) = 0; virtual std::string getRand_forTest() const = 0; diff --git a/src/mongo/db/storage/durable_catalog_impl.cpp b/src/mongo/db/storage/durable_catalog_impl.cpp index 020374a67c5..4cbd8d83b41 100644 --- a/src/mongo/db/storage/durable_catalog_impl.cpp +++ b/src/mongo/db/storage/durable_catalog_impl.cpp @@ -59,7 +59,6 @@ namespace { // It is never used with KVEngines that support doc-level locking so this should never conflict // with anything else. -const char kIsFeatureDocumentFieldName[] = "isFeatureDoc"; const char kNamespaceFieldName[] = "ns"; const char kNonRepairableFeaturesFieldName[] = "nonRepairable"; const char kRepairableFeaturesFieldName[] = "repairable"; @@ -198,14 +197,6 @@ public: const RecordId _catalogId; }; -bool DurableCatalogImpl::isFeatureDocument(BSONObj obj) { - BSONElement firstElem = obj.firstElement(); - if (firstElem.fieldNameStringData() == kIsFeatureDocumentFieldName) { - return firstElem.booleanSafe(); - } - return false; -} - DurableCatalogImpl::DurableCatalogImpl(RecordStore* rs, bool directoryPerDb, bool directoryForIndexes, diff --git a/src/mongo/db/storage/durable_catalog_impl.h b/src/mongo/db/storage/durable_catalog_impl.h index 19a0acf0cd1..370366cfb52 100644 --- a/src/mongo/db/storage/durable_catalog_impl.h +++ b/src/mongo/db/storage/durable_catalog_impl.h @@ -187,9 +187,6 @@ private: */ bool _hasEntryCollidingWithRand(WithLock) const; - // Allows featureDocuments to be checked with older versions - static bool isFeatureDocument(BSONObj obj); - RecordStore* _rs; // not owned const bool _directoryPerDb; const bool _directoryForIndexes; -- cgit v1.2.1