summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2022-02-24 14:49:45 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-24 21:36:24 +0000
commit2a5b59c4fd6d4182f81755ebd1ff755dd88db6e9 (patch)
treee53a12167fda4d9dcb1072435088b032ba5f20bc
parentab0af4dc877ea795069b720b5900e313f7e36f02 (diff)
downloadmongo-2a5b59c4fd6d4182f81755ebd1ff755dd88db6e9.tar.gz
SERVER-62006 inline DurableCatalog::isFeatureDocument()
-rw-r--r--src/mongo/db/storage/durable_catalog.h14
-rw-r--r--src/mongo/db/storage/durable_catalog_impl.cpp9
-rw-r--r--src/mongo/db/storage/durable_catalog_impl.h3
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<Entry> 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;