diff options
Diffstat (limited to 'src/mongo/db/pipeline')
| -rw-r--r-- | src/mongo/db/pipeline/document_source_writer.h | 19 |
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( |
