diff options
author | Martin Neupauer <martin.neupauer@mongodb.com> | 2019-05-29 15:49:31 -0400 |
---|---|---|
committer | Martin Neupauer <martin.neupauer@mongodb.com> | 2019-05-30 11:32:26 -0400 |
commit | bf6275237ba6696954e6593dec9ce134aba97e6d (patch) | |
tree | e0bce661e0111aefd10231b8f8247155d4726956 /src/mongo/db/pipeline | |
parent | da754e6c0490a3ccacd04339f34fafbd878331b4 (diff) | |
download | mongo-bf6275237ba6696954e6593dec9ce134aba97e6d.tar.gz |
SERVER-41293 Metadata size is double counted in Document::getApproximateSize()
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/document.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/document.cpp b/src/mongo/db/pipeline/document.cpp index a4c17d92501..1b8d8ecb5cb 100644 --- a/src/mongo/db/pipeline/document.cpp +++ b/src/mongo/db/pipeline/document.cpp @@ -235,14 +235,16 @@ intrusive_ptr<DocumentStorage> DocumentStorage::clone() const { } size_t DocumentStorage::getMetadataApproximateSize() const { + // We count only the "deep" portion of the metadata values. The rest is counted in the size of + // the DocumentStorage class. size_t size = 0; - size += sizeof(_textScore); - size += sizeof(_randVal); size += _sortKey.objsize(); - size += sizeof(_geoNearDistance); size += _geoNearPoint.getApproximateSize(); - size += sizeof(_searchScore); + // Size of Value is double counted - once in sizeof(DocumentStorage) and once in + // getApproximateSize() + size -= sizeof(_geoNearPoint); size += _searchHighlights.getApproximateSize(); + size -= sizeof(_searchHighlights); return size; } |