From 1f64bbda633458a045efbb4fc32a2d52412a3942 Mon Sep 17 00:00:00 2001 From: Simon Graetzer Date: Wed, 9 Jun 2021 09:39:11 +0000 Subject: SERVER-57433 Report rename collection parameters in currentOp --- jstests/sharding/ddl_ops_reported_on_current_op_command.js | 10 +++++----- src/mongo/db/s/create_collection_coordinator.cpp | 2 +- src/mongo/db/s/rename_collection_coordinator.cpp | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/jstests/sharding/ddl_ops_reported_on_current_op_command.js b/jstests/sharding/ddl_ops_reported_on_current_op_command.js index 1e12ea06bff..97f6e31803a 100644 --- a/jstests/sharding/ddl_ops_reported_on_current_op_command.js +++ b/jstests/sharding/ddl_ops_reported_on_current_op_command.js @@ -56,9 +56,8 @@ let getCurrentOpOfDDL = (ddlOpThread, desc) => { assert.eq(nss, currOp[0].ns); // It must have at least the shardKey. assert(currOp[0].hasOwnProperty('command')); - assert(currOp[0].command.hasOwnProperty('request')); - assert(currOp[0].command.request.hasOwnProperty('shardKey')); - assert.eq(shardKey, currOp[0].command.request.shardKey); + assert(currOp[0].command.hasOwnProperty('shardKey')); + assert.eq(shardKey, currOp[0].command.shardKey); } { @@ -74,9 +73,10 @@ let getCurrentOpOfDDL = (ddlOpThread, desc) => { // There must be one operation running with the appropiate ns. assert.eq(1, currOp.length); assert.eq(nss, currOp[0].ns); + // It must have the target collection. - assert(currOp[0].hasOwnProperty('to')); - assert.eq(toNss, currOp[0].to); + assert(currOp[0].hasOwnProperty('command')); + assert.docEq({to: toNss, dropTarget: true, stayTemp: false}, currOp[0].command); } { diff --git a/src/mongo/db/s/create_collection_coordinator.cpp b/src/mongo/db/s/create_collection_coordinator.cpp index 3dd8863055a..388366a8632 100644 --- a/src/mongo/db/s/create_collection_coordinator.cpp +++ b/src/mongo/db/s/create_collection_coordinator.cpp @@ -332,7 +332,7 @@ boost::optional CreateCollectionCoordinator::reportForCurrentOp( if (const auto& optComment = getForwardableOpMetadata().getComment()) { cmdBob.append(optComment.get().firstElement()); } - cmdBob.append("request", _doc.getCreateCollectionRequest().toBSON()); + cmdBob.appendElements(_doc.getCreateCollectionRequest().toBSON()); BSONObjBuilder bob; bob.append("type", "op"); diff --git a/src/mongo/db/s/rename_collection_coordinator.cpp b/src/mongo/db/s/rename_collection_coordinator.cpp index 83add06607f..08168994c1e 100644 --- a/src/mongo/db/s/rename_collection_coordinator.cpp +++ b/src/mongo/db/s/rename_collection_coordinator.cpp @@ -106,12 +106,13 @@ boost::optional RenameCollectionCoordinator::reportForCurrentOp( if (const auto& optComment = getForwardableOpMetadata().getComment()) { cmdBob.append(optComment.get().firstElement()); } + cmdBob.appendElements(_doc.getRenameCollectionRequest().toBSON()); + BSONObjBuilder bob; bob.append("type", "op"); bob.append("desc", "RenameCollectionCoordinator"); bob.append("op", "command"); bob.append("ns", nss().toString()); - bob.append("to", _doc.getTo().toString()); bob.append("command", cmdBob.obj()); bob.append("currentPhase", _doc.getPhase()); bob.append("active", true); -- cgit v1.2.1