summaryrefslogtreecommitdiff
path: root/src/mongo/idl
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/idl
parentd4a75cff6bc10b74edb54945cb7104b725554d97 (diff)
downloadmongo-c8858462a9e9e5eee912db81e9f069f01b3aa6d4.tar.gz
SERVER-68343 Handle tenantId in GetClusterParameterInvocation & ClusterServerParameterOpObserver
Diffstat (limited to 'src/mongo/idl')
-rw-r--r--src/mongo/idl/cluster_server_parameter_op_observer.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mongo/idl/cluster_server_parameter_op_observer.cpp b/src/mongo/idl/cluster_server_parameter_op_observer.cpp
index ee2e1582796..44db25c7bff 100644
--- a/src/mongo/idl/cluster_server_parameter_op_observer.cpp
+++ b/src/mongo/idl/cluster_server_parameter_op_observer.cpp
@@ -42,14 +42,15 @@ constexpr auto kIdField = "_id"_sd;
constexpr auto kOplog = "oplog"_sd;
/**
- * Per-operation scratch space indicating the document being deleted.
- * This is used in the aboutToDelte/onDelete handlers since the document
- * is not necessarily available in the latter.
+ * Per-operation scratch space indicating the document being deleted and the tenantId of the tenant
+ * associated. This is used in the aboutToDelte/onDelete handlers since the document is not
+ * necessarily available in the latter.
*/
const auto aboutToDeleteDoc = OperationContext::declareDecoration<std::string>();
+const auto tenantIdToDelete = OperationContext::declareDecoration<boost::optional<TenantId>>();
bool isConfigNamespace(const NamespaceString& nss) {
- return nss == NamespaceString::kClusterParametersNamespace;
+ return nss == NamespaceString::makeClusterParametersNSS(nss.dbName().tenantId());
}
} // namespace
@@ -85,6 +86,8 @@ void ClusterServerParameterOpObserver::aboutToDelete(OperationContext* opCtx,
std::string docBeingDeleted;
if (isConfigNamespace(nss)) {
+ // Store the tenantId associated with the doc to be deleted.
+ tenantIdToDelete(opCtx) = nss.dbName().tenantId();
auto elem = doc[kIdField];
if (elem.type() == String) {
docBeingDeleted = elem.str();
@@ -180,7 +183,10 @@ void ClusterServerParameterOpObserver::onImportCollection(OperationContext* opCt
void ClusterServerParameterOpObserver::_onReplicationRollback(OperationContext* opCtx,
const RollbackObserverInfo& rbInfo) {
- if (rbInfo.rollbackNamespaces.count(NamespaceString::kClusterParametersNamespace)) {
+ if (rbInfo.rollbackNamespaces.end() !=
+ std::find_if(rbInfo.rollbackNamespaces.begin(),
+ rbInfo.rollbackNamespaces.end(),
+ isConfigNamespace)) {
// Some kind of rollback happend in the settings collection.
// Just reload from disk to be safe.
ClusterServerParameterInitializer::get(opCtx)->resynchronizeAllParametersFromDisk(opCtx);