Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 1 | From ad37ee80b32a1f740a3197105174d74dff11e4e8 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 13 Apr 2022 13:56:32 -0700 |
| 4 | Subject: [PATCH] add explict static_cast<size_t> to maxMemoryUsageBytes |
| 5 | |
| 6 | Fixes |
| 7 | src/mongo/db/pipeline/document_source_group.cpp:377:22: error: non-constant-expression cannot be narrowed from type 'long long' to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] |
| 8 | maxMemoryUsageBytes ? *maxMemoryUsageBytes |
| 9 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 | src/mongo/db/pipeline/document_source_group.cpp:377:22: note: insert an explicit cast to silence this issue |
| 11 | maxMemoryUsageBytes ? *maxMemoryUsageBytes |
| 12 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 13 | |
| 14 | Upstream-Status: Pending |
| 15 | |
| 16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 17 | --- |
| 18 | src/mongo/db/pipeline/document_source_group.cpp | 4 ++-- |
| 19 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 20 | |
| 21 | diff --git a/src/mongo/db/pipeline/document_source_group.cpp b/src/mongo/db/pipeline/document_source_group.cpp |
| 22 | index 4a7b48d6cd2..9a6076c6041 100644 |
| 23 | --- a/src/mongo/db/pipeline/document_source_group.cpp |
| 24 | +++ b/src/mongo/db/pipeline/document_source_group.cpp |
| 25 | @@ -374,8 +374,8 @@ DocumentSourceGroup::DocumentSourceGroup(const intrusive_ptr<ExpressionContext>& |
| 26 | _usedDisk(false), |
| 27 | _doingMerge(false), |
| 28 | _memoryTracker{pExpCtx->allowDiskUse && !pExpCtx->inMongos, |
| 29 | - maxMemoryUsageBytes ? *maxMemoryUsageBytes |
| 30 | - : internalDocumentSourceGroupMaxMemoryBytes.load()}, |
| 31 | + static_cast<size_t>(maxMemoryUsageBytes ? *maxMemoryUsageBytes |
| 32 | + : internalDocumentSourceGroupMaxMemoryBytes.load())}, |
| 33 | // We spill to disk in debug mode, regardless of allowDiskUse, to stress the system. |
| 34 | _file(!pExpCtx->inMongos && (pExpCtx->allowDiskUse || kDebugBuild) |
| 35 | ? std::make_shared<Sorter<Value, Value>::File>(pExpCtx->tempDir + "/" + |
| 36 | -- |
| 37 | 2.35.2 |
| 38 | |