diff options
author | Jason Zhang <jason.zhang@mongodb.com> | 2023-05-17 02:23:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-05-17 03:15:10 +0000 |
commit | 06797deec0c5806e56a70a7d156556e0b028da7f (patch) | |
tree | 07788fd471fdf4584b7b4b944c867d78932b88ec /src/mongo/s/write_ops/write_without_shard_key_util.h | |
parent | b4b4b310cd5fe22d33a749eca4e43c42c2adf76c (diff) | |
download | mongo-06797deec0c5806e56a70a7d156556e0b028da7f.tar.gz |
SERVER-69922 Implement explain for updateOne, deleteOne, and findAndModify
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.h | 12 |
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 |