summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSophia Tan <sophia_tll@hotmail.com>2022-10-31 23:47:39 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-01 00:49:39 +0000
commit4db2628c4897f7fc2fa2e7e2555008f7cbc8752f (patch)
treea6b4cd437c1fbe6de0dc443b51ee9d99bc7ac8d0
parent9cad5aec81a4d40a5d61fe8e63ddc02c869b1a12 (diff)
downloadmongo-4db2628c4897f7fc2fa2e7e2555008f7cbc8752f.tar.gz
SERVER-70853 Time series namespace string should have tenant information in multitenancy mode
-rw-r--r--buildscripts/resmokeconfig/suites/native_tenant_data_isolation_jscore_passthrough.yml3
-rw-r--r--src/mongo/db/catalog/create_collection.cpp2
-rw-r--r--src/mongo/db/commands/find_cmd.cpp8
-rw-r--r--src/mongo/db/namespace_string.cpp4
-rw-r--r--src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp5
5 files changed, 12 insertions, 10 deletions
diff --git a/buildscripts/resmokeconfig/suites/native_tenant_data_isolation_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/native_tenant_data_isolation_jscore_passthrough.yml
index 52ef9641034..095ece529da 100644
--- a/buildscripts/resmokeconfig/suites/native_tenant_data_isolation_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/native_tenant_data_isolation_jscore_passthrough.yml
@@ -7,6 +7,9 @@ selector:
- jstests/core/basic8.js
- jstests/core/count.js
- jstests/core/all.js
+ - jstests/core/timeseries/timeseries_internal_bucket_geo_within.js
+ - jstests/core/timeseries/bucket_granularity.js
+ - jstests/core/timeseries/timeseries_graph_lookup.js
executor:
archive:
diff --git a/src/mongo/db/catalog/create_collection.cpp b/src/mongo/db/catalog/create_collection.cpp
index 79fecf84cd7..69d71d25468 100644
--- a/src/mongo/db/catalog/create_collection.cpp
+++ b/src/mongo/db/catalog/create_collection.cpp
@@ -409,7 +409,7 @@ Status _createTimeseries(OperationContext* opCtx,
AutoGetCollection::Options{}.viewMode(auto_get_collection::ViewMode::kViewsPermitted));
Lock::CollectionLock systemDotViewsLock(
opCtx,
- NamespaceString(ns.db(), NamespaceString::kSystemDotViewsCollectionName),
+ NamespaceString(ns.dbName(), NamespaceString::kSystemDotViewsCollectionName),
MODE_X);
auto db = autoColl.ensureDbExists(opCtx);
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index c37f7fee94c..425bcd40800 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -545,10 +545,10 @@ public:
const auto& findCommand = cq->getFindCommandRequest();
auto viewAggregationCommand =
uassertStatusOK(query_request_helper::asAggregationCommand(findCommand));
-
- BSONObj aggResult = CommandHelpers::runCommandDirectly(
- opCtx,
- OpMsgRequest::fromDBAndBody(_dbName.db(), std::move(viewAggregationCommand)));
+ auto aggRequest =
+ OpMsgRequestBuilder::create(_dbName, std::move(viewAggregationCommand));
+ aggRequest.validatedTenancyScope = _request.validatedTenancyScope;
+ BSONObj aggResult = CommandHelpers::runCommandDirectly(opCtx, aggRequest);
auto status = getStatusFromCommandResult(aggResult);
if (status.code() == ErrorCodes::InvalidPipelineOperator) {
uasserted(ErrorCodes::InvalidPipelineOperator,
diff --git a/src/mongo/db/namespace_string.cpp b/src/mongo/db/namespace_string.cpp
index a45f99552f5..999aee6dc59 100644
--- a/src/mongo/db/namespace_string.cpp
+++ b/src/mongo/db/namespace_string.cpp
@@ -495,12 +495,12 @@ bool NamespaceString::isSystemStatsCollection() const {
}
NamespaceString NamespaceString::makeTimeseriesBucketsNamespace() const {
- return {db(), kTimeseriesBucketsCollectionPrefix.toString() + coll()};
+ return {dbName(), kTimeseriesBucketsCollectionPrefix.toString() + coll()};
}
NamespaceString NamespaceString::getTimeseriesViewNamespace() const {
invariant(isTimeseriesBucketsCollection(), ns());
- return {db(), coll().substr(kTimeseriesBucketsCollectionPrefix.size())};
+ return {dbName(), coll().substr(kTimeseriesBucketsCollectionPrefix.size())};
}
bool NamespaceString::isImplicitlyReplicated() const {
diff --git a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
index 0731249fa29..e8e109aee8f 100644
--- a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
@@ -422,9 +422,8 @@ CommonMongodProcessInterface::attachCursorSourceToPipelineForLocalRead(Pipeline*
}
boost::optional<AutoGetCollectionForReadCommandMaybeLockFree> autoColl;
- const NamespaceStringOrUUID nsOrUUID = expCtx->uuid
- ? NamespaceStringOrUUID{expCtx->ns.db().toString(), *expCtx->uuid}
- : expCtx->ns;
+ const NamespaceStringOrUUID nsOrUUID =
+ expCtx->uuid ? NamespaceStringOrUUID{expCtx->ns.dbName(), *expCtx->uuid} : expCtx->ns;
// Reparse 'pipeline' to discover whether there are secondary namespaces that we need to lock
// when constructing our query executor.