summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_out.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/document_source_out.h')
-rw-r--r--src/mongo/db/pipeline/document_source_out.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/db/pipeline/document_source_out.h b/src/mongo/db/pipeline/document_source_out.h
index 64dda167eb3..0be5153cdf0 100644
--- a/src/mongo/db/pipeline/document_source_out.h
+++ b/src/mongo/db/pipeline/document_source_out.h
@@ -121,19 +121,25 @@ private:
void finalize() override;
- void spill(BatchedObjects&& batch) override {
+ void spill(BatchedCommandRequest&& bcr, BatchedObjects&& batch) override {
DocumentSourceWriteBlock writeBlock(pExpCtx->opCtx);
+ auto insertCommand = bcr.extractInsertRequest();
+ insertCommand->setDocuments(std::move(batch));
auto targetEpoch = boost::none;
+
uassertStatusOK(pExpCtx->mongoProcessInterface->insert(
- pExpCtx, _tempNs, std::move(batch), _writeConcern, targetEpoch));
+ pExpCtx, _tempNs, std::move(insertCommand), _writeConcern, targetEpoch));
}
std::pair<BSONObj, int> makeBatchObject(Document&& doc) const override {
auto obj = doc.toBson();
- return {obj, obj.objsize()};
+ tassert(6628900, "_writeSizeEstimator should be initialized", _writeSizeEstimator);
+ return {obj, _writeSizeEstimator->estimateInsertSizeBytes(obj)};
}
+ BatchedCommandRequest initializeBatchedWriteRequest() const override;
+
void waitWhileFailPointEnabled() override;
// Holds on to the original collection options and index specs so we can check they didn't