summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@mongodb.com>2020-05-11 15:55:58 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-14 22:17:25 +0000
commitaebf6a5d01a28c7d5a3a4ee68d11c2e150291131 (patch)
treed9245faa82d7a1482b1b1c978b757d7eaeb38571 /src/mongo/db/db_raii.cpp
parent9d8eb69d583b89682520ec58595e558d5f6cc9a2 (diff)
downloadmongo-aebf6a5d01a28c7d5a3a4ee68d11c2e150291131.tar.gz
SERVER-47803 Move the database level profile setting from Database into CollectionCatalog
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index 53dda3ca490..f15adadabf3 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -59,25 +59,13 @@ AutoStatsTracker::AutoStatsTracker(OperationContext* opCtx,
const NamespaceString& nss,
Top::LockType lockType,
LogMode logMode,
- boost::optional<int> dbProfilingLevel,
+ int dbProfilingLevel,
Date_t deadline)
: _opCtx(opCtx), _lockType(lockType), _nss(nss), _logMode(logMode) {
if (_logMode == LogMode::kUpdateTop) {
return;
}
- if (!dbProfilingLevel) {
- // No profiling level was determined, attempt to read the profiling level from the Database
- // object. Since we are only reading the in-memory profiling level out of the database
- // object (which is configured on a per-node basis and not replicated or persisted), we
- // never need to conflict with secondary batch application.
- ShouldNotConflictWithSecondaryBatchApplicationBlock noConflict(opCtx->lockState());
- AutoGetDb autoDb(_opCtx, _nss.db(), MODE_IS, deadline);
- if (autoDb.getDb()) {
- dbProfilingLevel = autoDb.getDb()->getProfilingLevel();
- }
- }
-
stdx::lock_guard<Client> clientLock(*_opCtx->getClient());
CurOp::get(_opCtx)->enter_inlock(_nss.ns().c_str(), dbProfilingLevel);
}
@@ -256,13 +244,13 @@ AutoGetCollectionForReadCommand::AutoGetCollectionForReadCommand(
Date_t deadline,
AutoStatsTracker::LogMode logMode)
: _autoCollForRead(opCtx, nsOrUUID, viewMode, deadline),
- _statsTracker(opCtx,
- _autoCollForRead.getNss(),
- Top::LockType::ReadLocked,
- logMode,
- _autoCollForRead.getDb() ? _autoCollForRead.getDb()->getProfilingLevel()
- : kDoNotChangeProfilingLevel,
- deadline) {
+ _statsTracker(
+ opCtx,
+ _autoCollForRead.getNss(),
+ Top::LockType::ReadLocked,
+ logMode,
+ CollectionCatalog::get(opCtx).getDatabaseProfileLevel(_autoCollForRead.getNss().db()),
+ deadline) {
if (!_autoCollForRead.getView()) {
auto* const css = CollectionShardingState::get(opCtx, _autoCollForRead.getNss());
@@ -294,7 +282,8 @@ OldClientContext::OldClientContext(OperationContext* opCtx, const std::string& n
}
stdx::lock_guard<Client> lk(*_opCtx->getClient());
- currentOp->enter_inlock(ns.c_str(), _db->getProfilingLevel());
+ currentOp->enter_inlock(ns.c_str(),
+ CollectionCatalog::get(opCtx).getDatabaseProfileLevel(_db->name()));
}
OldClientContext::~OldClientContext() {