summaryrefslogtreecommitdiff
path: root/src/mongo/db/namespace_string.cpp
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2022-03-31 23:48:29 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-01 05:53:42 +0000
commitbde82201650d83dc86aa7795594a0264feb95c7f (patch)
treeb71211dd250042aa5e0000957d97fcc61f076012 /src/mongo/db/namespace_string.cpp
parentcbd9d61b6e44a560cb01b7412093502148327d56 (diff)
downloadmongo-bde82201650d83dc86aa7795594a0264feb95c7f.tar.gz
SERVER-64644 Prohibit sharding of FLE 2 state collections
Diffstat (limited to 'src/mongo/db/namespace_string.cpp')
-rw-r--r--src/mongo/db/namespace_string.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/namespace_string.cpp b/src/mongo/db/namespace_string.cpp
index bd9d3a68d93..2eab32c841f 100644
--- a/src/mongo/db/namespace_string.cpp
+++ b/src/mongo/db/namespace_string.cpp
@@ -45,6 +45,11 @@ constexpr auto listCollectionsCursorCol = "$cmd.listCollections"_sd;
constexpr auto collectionlessAggregateCursorCol = "$cmd.aggregate"_sd;
constexpr auto dropPendingNSPrefix = "system.drop."_sd;
+constexpr auto fle2Prefix = "fle2."_sd;
+constexpr auto fle2EscSuffix = ".esc"_sd;
+constexpr auto fle2EccSuffix = ".ecc"_sd;
+constexpr auto fle2EcocSuffix = ".ecoc"_sd;
+
} // namespace
constexpr StringData NamespaceString::kAdminDb;
@@ -374,6 +379,12 @@ bool NamespaceString::isConfigTransactionsCollection() const {
return ns() == kSessionTransactionsTableNamespace.ns();
}
+bool NamespaceString::isFLE2StateCollection() const {
+ return coll().startsWith(fle2Prefix) &&
+ (coll().endsWith(fle2EscSuffix) || coll().endsWith(fle2EccSuffix) ||
+ coll().endsWith(fle2EcocSuffix));
+}
+
NamespaceString NamespaceString::makeTimeseriesBucketsNamespace() const {
return {db(), kTimeseriesBucketsCollectionPrefix.toString() + coll()};
}