summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-12-09 17:48:30 -0500
committerDavid Storch <david.storch@10gen.com>2015-12-11 13:28:20 -0500
commitbb7e1e539da115da4ee1146c79e47c23109dce95 (patch)
tree8515a87718fc373e8d3fe2772b539c0b12046a70 /src/mongo/db/curop.cpp
parentf28df29ac82f17778f46c010a311198bec28b9b7 (diff)
downloadmongo-bb7e1e539da115da4ee1146c79e47c23109dce95.tar.gz
SERVER-21750 clean up getMore logging and profiling
--Omit ntoreturn and ntoskip from the getMore command log line. --Add nreturned to the getMore command log line. --Upconvert OP_GET_MORE profiler entries to match getMore cmd.
Diffstat (limited to 'src/mongo/db/curop.cpp')
-rw-r--r--src/mongo/db/curop.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp
index c4ef81cef97..0ba60bc86c3 100644
--- a/src/mongo/db/curop.cpp
+++ b/src/mongo/db/curop.cpp
@@ -37,7 +37,9 @@
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/commands/server_status_metric.h"
+#include "mongo/db/cursor_id.h"
#include "mongo/db/json.h"
+#include "mongo/db/query/getmore_request.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
@@ -121,6 +123,20 @@ BSONObj upconvertQueryEntry(const BSONObj& query,
return bob.obj();
}
+/**
+ * For a getMore using OP_GET_MORE, as opposed to getMore command, upconverts the "query" field so
+ * that the profiling entry matches that of the getMore command.
+ */
+BSONObj upconvertGetMoreEntry(const NamespaceString& nss, CursorId cursorId, int ntoreturn) {
+ return GetMoreRequest(nss,
+ cursorId,
+ ntoreturn,
+ boost::none, // awaitDataTimeout
+ boost::none, // term
+ boost::none // lastKnownCommittedOpTime
+ ).toBSON();
+}
+
} // namespace
/**
@@ -590,6 +606,9 @@ void OpDebug::append(const CurOp& curop,
if (!iscommand && networkOp == dbQuery) {
appendAsObjOrString(
"query", upconvertQueryEntry(query, nss, ntoreturn, ntoskip), maxElementSize, &b);
+ } else if (!iscommand && networkOp == dbGetMore) {
+ appendAsObjOrString(
+ "query", upconvertGetMoreEntry(nss, cursorid, ntoreturn), maxElementSize, &b);
} else if (!query.isEmpty()) {
const char* fieldName = (logicalOp == LogicalOp::opCommand) ? "command" : "query";
appendAsObjOrString(fieldName, query, maxElementSize, &b);