summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/pipeline/document_source_writer.h19
-rw-r--r--src/mongo/db/query/query_knobs.idl13
2 files changed, 17 insertions, 15 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(
diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl
index 53885816fc8..7dc4684eb80 100644
--- a/src/mongo/db/query/query_knobs.idl
+++ b/src/mongo/db/query/query_knobs.idl
@@ -448,12 +448,13 @@ server_parameters:
cpp_vartype: AtomicWord<bool>
default: false
- documentSourceWriterBatchBuffer:
- description: 'Space to reserve in document source writer batches for miscellaneous metadata'
- set_at: startup
- cpp_vartype: int
- cpp_varname: gDocumentSourceWriterBatchBufferBytes
+ internalQueryDocumentSourceWriterBatchExtraReservedBytes:
+ description: "Space to reserve in document source writer batches for miscellaneous metadata"
+ set_at: [ startup, runtime ]
+ cpp_vartype: AtomicWord<int>
+ cpp_varname: internalQueryDocumentSourceWriterBatchExtraReservedBytes
validator:
gte: 0
- lte: 8388608 # 8MB
+ lte:
+ expr: 8 * 1024 * 1024 # 8MB
default: 0