summaryrefslogtreecommitdiff
path: root/src/mongo/db/db_raii.cpp
diff options
context:
space:
mode:
authorDevin Hilly <devin.hilly@mongodb.com>2018-11-13 17:55:50 -0500
committerDevin Hilly <devin.hilly@mongodb.com>2018-11-20 11:24:41 -0500
commit1862b00862a6ea9c3fdd08bba52ea6a016eccbc5 (patch)
treee0004fc325c86b0e4465fc602dd0d453df83bbec /src/mongo/db/db_raii.cpp
parentb92c7480df5406cb9487228af36cb10bb973e77c (diff)
downloadmongo-1862b00862a6ea9c3fdd08bba52ea6a016eccbc5.tar.gz
SERVER-31098 Wrong ns in system.profile for aggregation query
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r--src/mongo/db/db_raii.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp
index b195e4ce5d0..2d3279dc41e 100644
--- a/src/mongo/db/db_raii.cpp
+++ b/src/mongo/db/db_raii.cpp
@@ -57,27 +57,30 @@ MONGO_EXPORT_SERVER_PARAMETER(allowSecondaryReadsDuringBatchApplication, bool, t
AutoStatsTracker::AutoStatsTracker(OperationContext* opCtx,
const NamespaceString& nss,
Top::LockType lockType,
+ LogMode logMode,
boost::optional<int> dbProfilingLevel,
Date_t deadline)
- : _opCtx(opCtx), _lockType(lockType) {
- if (!dbProfilingLevel) {
+ : _opCtx(opCtx), _lockType(lockType), _nss(nss) {
+ if (!dbProfilingLevel && logMode == LogMode::kUpdateTopAndCurop) {
// No profiling level was determined, attempt to read the profiling level from the Database
// object.
- AutoGetDb autoDb(_opCtx, nss.db(), MODE_IS, deadline);
+ 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);
+ if (logMode == LogMode::kUpdateTopAndCurop) {
+ CurOp::get(_opCtx)->enter_inlock(_nss.ns().c_str(), dbProfilingLevel);
+ }
}
AutoStatsTracker::~AutoStatsTracker() {
auto curOp = CurOp::get(_opCtx);
Top::get(_opCtx->getServiceContext())
.record(_opCtx,
- curOp->getNS(),
+ _nss.ns(),
curOp->getLogicalOp(),
_lockType,
durationCount<Microseconds>(curOp->elapsedTimeExcludingPauses()),
@@ -257,11 +260,13 @@ AutoGetCollectionForReadCommand::AutoGetCollectionForReadCommand(
OperationContext* opCtx,
const NamespaceStringOrUUID& nsOrUUID,
AutoGetCollection::ViewMode viewMode,
- Date_t deadline)
+ 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) {