summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_writer.h
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@mongodb.com>2023-06-29 02:11:23 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-06-29 02:35:52 +0000
commit36c047f935fd86b2d5ac4c4f5189e52daa044966 (patch)
treed70d4e35f932331ed6c3d9d8cbed090966b2e317 /src/mongo/db/pipeline/document_source_writer.h
parentb6f816f31c0bb4cf8845b0858346bc3d0290dc4e (diff)
SERVER-78314 Add server parameter internalQueryDocumentSourceWriterBatchExtraReservedBytesr4.4.23-rc0r4.4.23
(cherry picked from commit 67d3e420aa2c7e693fac97318a4a3fec1c6ced80)
Diffstat (limited to 'src/mongo/db/pipeline/document_source_writer.h')
-rw-r--r--src/mongo/db/pipeline/document_source_writer.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mongo/db/pipeline/document_source_writer.h b/src/mongo/db/pipeline/document_source_writer.h
index 10bb21ddefc..6b845745c18 100644
--- a/src/mongo/db/pipeline/document_source_writer.h
+++ b/src/mongo/db/pipeline/document_source_writer.h
@@ -237,19 +237,20 @@ DocumentSource::GetNextResult DocumentSourceWriter<B>::doGetNext() {
_initialized = true;
}
- // While most metadata attached to a command is limited to less than a KB,
- // Impersonation metadata may grow to an arbitrary size.
- // Ask the active Client how much impersonation metadata we'll use for it,
- // add in our own estimate of write header size, and assume that the rest can fit
- // in the space reserved by BSONObjMaxUserSize's overhead plus
- // the value from the server parameter: documentSourceWriterBatchBuffer.
+ // While most metadata attached to a command is limited to less than a KB, Impersonation
+ // metadata may grow to an arbitrary size.
+ //
+ // Ask the active Client how much impersonation metadata we'll use for it, add in our own
+ // estimate of write header size, and assume that the rest can fit in the space reserved by
+ // BSONObjMaxUserSize's overhead plus the value from the server parameter:
+ // internalQueryDocumentSourceWriterBatchExtraReservedBytes.
const auto estimatedMetadataSizeBytes =
- rpc::estimateImpersonatedUserMetadataSize(pExpCtx->opCtx) +
- gDocumentSourceWriterBatchBufferBytes;
+ rpc::estimateImpersonatedUserMetadataSize(pExpCtx->opCtx);
BatchedCommandRequest batchWrite = initializeBatchedWriteRequest();
const auto writeHeaderSize = estimateWriteHeaderSize(batchWrite);
- const auto initialRequestSize = estimatedMetadataSizeBytes + writeHeaderSize;
+ const auto initialRequestSize = estimatedMetadataSizeBytes + writeHeaderSize +
+ internalQueryDocumentSourceWriterBatchExtraReservedBytes.load();
uassert(7637800,
"Unable to proceed with write while metadata size ({}KB) exceeds {}KB"_format(