diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2018-10-10 10:15:51 -0400 |
---|---|---|
committer | Ted Tuckman <ted.tuckman@mongodb.com> | 2018-10-10 11:00:43 -0400 |
commit | 549616025c9d471767bc7ede342a9919cb3e6f94 (patch) | |
tree | 81eb64f21ccd81a935d2eb850d5e08194d3f8fb5 /src/mongo/db/pipeline/mongo_process_common.cpp | |
parent | 72e12b7765a932da1814cb62cb1b964e1121f696 (diff) | |
download | mongo-549616025c9d471767bc7ede342a9919cb3e6f94.tar.gz |
SERVER-37436 Add fields to idleCursor object in curOp
Diffstat (limited to 'src/mongo/db/pipeline/mongo_process_common.cpp')
-rw-r--r-- | src/mongo/db/pipeline/mongo_process_common.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/mongo_process_common.cpp b/src/mongo/db/pipeline/mongo_process_common.cpp index 1c97921e237..ac434ae88e5 100644 --- a/src/mongo/db/pipeline/mongo_process_common.cpp +++ b/src/mongo/db/pipeline/mongo_process_common.cpp @@ -37,6 +37,7 @@ #include "mongo/db/operation_context.h" #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/service_context.h" +#include "mongo/util/net/socket_utils.h" namespace mongo { @@ -79,7 +80,17 @@ std::vector<BSONObj> MongoProcessCommon::getCurrentOps( for (auto&& cursor : getIdleCursors(expCtx, userMode)) { BSONObjBuilder cursorObj; + auto ns = cursor.getNs(); + auto lsid = cursor.getLsid(); cursorObj.append("type", "idleCursor"); + cursorObj.append("host", getHostNameCached()); + cursorObj.append("ns", ns->toString()); + // If in legacy read mode, lsid is not present. + if (lsid) { + cursorObj.append("lsid", lsid->toBSON()); + } + cursor.setNs(boost::none); + cursor.setLsid(boost::none); // On mongos, planSummary is not present. auto planSummaryData = cursor.getPlanSummary(); if (planSummaryData) { @@ -94,6 +105,8 @@ std::vector<BSONObj> MongoProcessCommon::getCurrentOps( cursorObj.append("cursor", cursor.toBSON()); } ops.emplace_back(cursorObj.obj()); + cursor.setNs(ns); + cursor.setLsid(lsid); } } |