summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/bson_collection_catalog_entry.cpp
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2022-07-29 21:50:19 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-29 22:33:04 +0000
commitd2089eb428cd924660b229eedcf4685c71c812b5 (patch)
tree2c1ea240aa16da1f745f0ae53610ec9ddfba08e1 /src/mongo/db/storage/bson_collection_catalog_entry.cpp
parent2cea88c626b6d10f2eb0100abb1eb127e240b7e8 (diff)
downloadmongo-d2089eb428cd924660b229eedcf4685c71c812b5.tar.gz
SERVER-68133 Ensure tenantId included in namespace in durable catalog
Diffstat (limited to 'src/mongo/db/storage/bson_collection_catalog_entry.cpp')
-rw-r--r--src/mongo/db/storage/bson_collection_catalog_entry.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/storage/bson_collection_catalog_entry.cpp b/src/mongo/db/storage/bson_collection_catalog_entry.cpp
index 80012f1733c..601d9df7ac3 100644
--- a/src/mongo/db/storage/bson_collection_catalog_entry.cpp
+++ b/src/mongo/db/storage/bson_collection_catalog_entry.cpp
@@ -33,6 +33,7 @@
#include <numeric>
#include "mongo/db/field_ref.h"
+#include "mongo/db/namespace_string.h"
#include "mongo/db/server_options.h"
namespace mongo {
@@ -216,7 +217,7 @@ bool BSONCollectionCatalogEntry::MetaData::eraseIndex(StringData name) {
BSONObj BSONCollectionCatalogEntry::MetaData::toBSON(bool hasExclusiveAccess) const {
BSONObjBuilder b;
- b.append("ns", ns);
+ b.append("ns", nss.toStringWithTenantId());
b.append("options", options.toBSON());
{
BSONArrayBuilder arr(b.subarrayStart("indexes"));
@@ -264,7 +265,8 @@ BSONObj BSONCollectionCatalogEntry::MetaData::toBSON(bool hasExclusiveAccess) co
}
void BSONCollectionCatalogEntry::MetaData::parse(const BSONObj& obj) {
- ns = obj.getStringField("ns").toString();
+ nss = NamespaceString::parseFromStringExpectTenantIdInMultitenancyMode(
+ obj.getStringField("ns").toString());
if (obj["options"].isABSONObj()) {
options = uassertStatusOK(