summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorGabriel Marks <gabriel.marks@mongodb.com>2022-09-02 17:49:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-02 19:32:50 +0000
commitc8858462a9e9e5eee912db81e9f069f01b3aa6d4 (patch)
tree6c019346b4d46c2f41f4491f32584e4ae805ac17 /src/mongo/db/commands
parentd4a75cff6bc10b74edb54945cb7104b725554d97 (diff)
downloadmongo-c8858462a9e9e5eee912db81e9f069f01b3aa6d4.tar.gz
SERVER-68343 Handle tenantId in GetClusterParameterInvocation & ClusterServerParameterOpObserver
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/get_cluster_parameter_invocation.cpp18
-rw-r--r--src/mongo/db/commands/get_cluster_parameter_invocation.h4
2 files changed, 13 insertions, 9 deletions
diff --git a/src/mongo/db/commands/get_cluster_parameter_invocation.cpp b/src/mongo/db/commands/get_cluster_parameter_invocation.cpp
index 0624a103553..64e269ea20b 100644
--- a/src/mongo/db/commands/get_cluster_parameter_invocation.cpp
+++ b/src/mongo/db/commands/get_cluster_parameter_invocation.cpp
@@ -41,8 +41,8 @@
namespace mongo {
std::pair<std::vector<std::string>, std::vector<BSONObj>>
-GetClusterParameterInvocation::retrieveRequestedParameters(OperationContext* opCtx,
- const CmdBody& cmdBody) {
+GetClusterParameterInvocation::retrieveRequestedParameters(
+ OperationContext* opCtx, const CmdBody& cmdBody, const boost::optional<TenantId>& tenantId) {
ServerParameterSet* clusterParameters = ServerParameterSet::getClusterParameterSet();
std::vector<std::string> parameterNames;
std::vector<BSONObj> parameterValues;
@@ -54,7 +54,7 @@ GetClusterParameterInvocation::retrieveRequestedParameters(OperationContext* opC
// Skip any disabled cluster parameters.
if (requestedParameter->isEnabled()) {
BSONObjBuilder bob;
- requestedParameter->append(opCtx, &bob, requestedParameter->name(), boost::none);
+ requestedParameter->append(opCtx, &bob, requestedParameter->name(), tenantId);
parameterValues.push_back(bob.obj().getOwned());
parameterNames.push_back(requestedParameter->name());
}
@@ -109,12 +109,14 @@ GetClusterParameterInvocation::Reply GetClusterParameterInvocation::getCachedPar
OperationContext* opCtx, const GetClusterParameter& request) {
const CmdBody& cmdBody = request.getCommandParameter();
- auto [parameterNames, parameterValues] = retrieveRequestedParameters(opCtx, cmdBody);
+ auto [parameterNames, parameterValues] =
+ retrieveRequestedParameters(opCtx, cmdBody, request.getDbName().tenantId());
LOGV2_DEBUG(6226100,
2,
"Retrieved parameter values for cluster server parameters",
- "parameterNames"_attr = parameterNames);
+ "parameterNames"_attr = parameterNames,
+ "tenantId"_attr = request.getDbName().tenantId());
return Reply(parameterValues);
}
@@ -132,7 +134,8 @@ GetClusterParameterInvocation::Reply GetClusterParameterInvocation::getDurablePa
BSONObjBuilder inObjBuilder = queryDocBuilder.subobjStart("_id"_sd);
BSONArrayBuilder parameterNameBuilder = inObjBuilder.subarrayStart("$in"_sd);
- auto [requestedParameterNames, parameterValues] = retrieveRequestedParameters(opCtx, cmdBody);
+ auto [requestedParameterNames, parameterValues] =
+ retrieveRequestedParameters(opCtx, cmdBody, request.getDbName().tenantId());
for (const auto& parameterValue : parameterValues) {
parameterNameBuilder.append(parameterValue["_id"_sd].String());
@@ -182,7 +185,8 @@ GetClusterParameterInvocation::Reply GetClusterParameterInvocation::getDurablePa
for (const auto& defaultParameterName : defaultParameterNames) {
auto defaultParameter = clusterParameters->get(defaultParameterName);
BSONObjBuilder bob;
- defaultParameter->append(opCtx, &bob, defaultParameterName, boost::none);
+ defaultParameter->append(
+ opCtx, &bob, defaultParameterName, request.getDbName().tenantId());
retrievedParameters.push_back(bob.obj());
}
}
diff --git a/src/mongo/db/commands/get_cluster_parameter_invocation.h b/src/mongo/db/commands/get_cluster_parameter_invocation.h
index a122cd6be94..a980151aabe 100644
--- a/src/mongo/db/commands/get_cluster_parameter_invocation.h
+++ b/src/mongo/db/commands/get_cluster_parameter_invocation.h
@@ -53,9 +53,9 @@ public:
private:
// Parses the command body and retrieves the BSON representation and names of the requested
- // cluster parameters.
+ // cluster parameters for the given tenant.
std::pair<std::vector<std::string>, std::vector<BSONObj>> retrieveRequestedParameters(
- OperationContext* opCtx, const CmdBody& cmdBody);
+ OperationContext* opCtx, const CmdBody& cmdBody, const boost::optional<TenantId>& tenantId);
};
} // namespace mongo