From 59b0371902b5b278ef1e88a9c15424c6efeea666 Mon Sep 17 00:00:00 2001 From: Hari Khalsa Date: Mon, 13 Jan 2014 16:53:53 -0500 Subject: SERVER-3443 SERVER-7754 add plan exec stats to system profile --- src/mongo/db/client.cpp | 4 ++++ src/mongo/db/curop.h | 4 ++++ src/mongo/db/query/new_find.cpp | 10 +++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index 1e5e8b43367..2c4fd5b885b 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -729,6 +729,10 @@ namespace mongo { OPDEBUG_APPEND_NUMBER( responseLength ); b.append( "millis" , executionTime ); + if (!execStats.isEmpty()) { + b.append("execStats", execStats); + } + return true; } diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h index eed53648a81..3af7962c712 100644 --- a/src/mongo/db/curop.h +++ b/src/mongo/db/curop.h @@ -102,6 +102,10 @@ namespace mongo { bool upsert; // true if the update actually did an insert int keyUpdates; + // New Query Framework debugging/profiling info + // XXX: should this really be an opaque BSONObj? Not sure. + BSONObj execStats; + // error handling ExceptionInfo exceptionInfo; diff --git a/src/mongo/db/query/new_find.cpp b/src/mongo/db/query/new_find.cpp index 3a1aa67b641..fe9cc8b40ff 100644 --- a/src/mongo/db/query/new_find.cpp +++ b/src/mongo/db/query/new_find.cpp @@ -167,9 +167,7 @@ namespace mongo { curop.setMaxTimeMicros(cc->getLeftoverMaxTimeMicros()); killCurrentOp.checkForInterrupt(); // May trigger maxTimeAlwaysTimeOut fail point. - // TODO: - // curop.debug().query = BSONForQuery - // curop.setQuery(curop.debug().query); + // XXX: what should we set for the curop.debug() etc. here? // TODO: What is pass? if (0 == pass) { cc->updateSlaveLocation(curop); } @@ -217,6 +215,8 @@ namespace mongo { } } + // XXX: should we update the execution stats in curop.debug() here? + if (Runner::RUNNER_EOF == state && 0 == numResults && (queryOptions & QueryOption_CursorTailable) && (queryOptions & QueryOption_AwaitData) && (pass < 1000)) { @@ -680,6 +680,10 @@ namespace mongo { if (explain->isIDHackSet()) { curop.debug().idhack = explain->getIDHack(); } + + if (!explain->stats.isEmpty()) { + curop.debug().execStats = explain->stats; + } } // curop.debug().exhaust is set above. -- cgit v1.2.1