summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.cpp
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2018-09-27 15:06:56 -0400
committerTed Tuckman <ted.tuckman@mongodb.com>2018-10-02 13:09:24 -0400
commit25de6274b865e1ebe75c4a8c0f8f5540b364eff0 (patch)
tree67b8d83c426b3ee012123e7e9f0376f219e0b4ff /src/mongo/db/curop.cpp
parent6c5a7bb094cae90823bd05d8d21074cf2ea79990 (diff)
downloadmongo-25de6274b865e1ebe75c4a8c0f8f5540b364eff0.tar.gz
SERVER-37006 Move originatingCommand from currentOp inprog to cursor object
Diffstat (limited to 'src/mongo/db/curop.cpp')
-rw-r--r--src/mongo/db/curop.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp
index 57e0d04b59f..34df70eccb9 100644
--- a/src/mongo/db/curop.cpp
+++ b/src/mongo/db/curop.cpp
@@ -487,15 +487,19 @@ void CurOp::reportState(BSONObjBuilder* builder, bool truncateOps) {
appendAsObjOrString("command", _opDescription, maxQuerySize, builder);
- if (!_originatingCommand.isEmpty()) {
- appendAsObjOrString("originatingCommand", _originatingCommand, maxQuerySize, builder);
- }
-
if (!_planSummary.empty()) {
builder->append("planSummary", _planSummary);
}
if (_genericCursor) {
+ // This creates a new builder to truncate the object that will go into the curOp output. In
+ // order to make sure the object is not too large but not truncate the comment, we only
+ // truncate the originatingCommand and not the entire cursor.
+ BSONObjBuilder tempObj;
+ appendAsObjOrString(
+ "truncatedObj", _genericCursor->getOriginatingCommand().get(), maxQuerySize, &tempObj);
+ auto originatingCommand = tempObj.done().getObjectField("truncatedObj");
+ _genericCursor->setOriginatingCommand(originatingCommand.getOwned());
builder->append("cursor", _genericCursor->toBSON());
}