summaryrefslogtreecommitdiff
path: root/src/mongo/s/write_ops/write_without_shard_key_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/write_ops/write_without_shard_key_util.h')
-rw-r--r--src/mongo/s/write_ops/write_without_shard_key_util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/s/write_ops/write_without_shard_key_util.h b/src/mongo/s/write_ops/write_without_shard_key_util.h
index bb7e4d0509b..5fb9bb35d68 100644
--- a/src/mongo/s/write_ops/write_without_shard_key_util.h
+++ b/src/mongo/s/write_ops/write_without_shard_key_util.h
@@ -38,6 +38,11 @@
namespace mongo {
namespace write_without_shard_key {
+// Used as a "dummy" target document for constructing explain responses for single writes without
+// shard key.
+const BSONObj targetDocForExplain = BSON("_id"
+ << "WriteWithoutShardKey");
+
/**
* Uses updateDriver to produce the document to insert. Only use when {upsert: true}.
*/
@@ -75,6 +80,13 @@ bool useTwoPhaseProtocol(OperationContext* opCtx,
StatusWith<ClusterWriteWithoutShardKeyResponse> runTwoPhaseWriteProtocol(OperationContext* opCtx,
NamespaceString nss,
BSONObj cmdObj);
+/**
+ * Return a formatted 'explain' response that describes the work done in the two phase write
+ * protocol.
+ **/
+BSONObj generateExplainResponseForTwoPhaseWriteProtocol(
+ const BSONObj& clusterQueryWithoutShardKeyExplainObj,
+ const BSONObj& clusterWriteWithoutShardKeyExplainObj);
} // namespace write_without_shard_key
} // namespace mongo