diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-08-24 15:17:08 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-08-24 15:17:08 +0000 |
commit | d546929a5e4dabaac53717d45dd2bb5c818429a4 (patch) | |
tree | 125dc5075f93399b6b46560834d6b7c9745d4095 /searchlib/src | |
parent | 26d0b997cc573bac2a1d7eda7a2494449452e121 (diff) |
Add 'paged' support for reference attribute fields.
The memory usage of a reference attribute can be calculated as follows:
num_child_docs * 8 + num_parent_docs * 24 + num_child_docs_where_parent_reference_is_set * 4.
When using 'paged' the btrees used in the reverse mapping from parent lid to child lids are still memory allocated.
This is the num_child_docs_where_parent_reference_is_set part of the equation above.
Diffstat (limited to 'searchlib/src')
4 files changed, 11 insertions, 8 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index c0df44d26e9..56ef1860724 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -61,7 +61,7 @@ allow_paged(const search::attribute::Config& config) return false; } using Type = search::attribute::BasicType::Type; - if (config.basicType() == Type::REFERENCE || config.basicType() == Type::PREDICATE) { + if (config.basicType() == Type::PREDICATE) { return false; } if (config.basicType() == Type::TENSOR) { diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp index 7ff04f789b2..0c61eafe1d7 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp @@ -46,11 +46,11 @@ ReferenceAttribute::ReferenceAttribute(const vespalib::stringref baseFileName) ReferenceAttribute::ReferenceAttribute(const vespalib::stringref baseFileName, const Config & cfg) : NotImplementedAttribute(baseFileName, cfg), - _store({}), - _indices(cfg.getGrowStrategy(), getGenerationHolder()), + _store(get_memory_allocator()), + _indices(cfg.getGrowStrategy(), getGenerationHolder(), get_initial_alloc()), _compaction_spec(), _gidToLidMapperFactory(), - _referenceMappings(getGenerationHolder(), getCommittedDocIdLimitRef()) + _referenceMappings(getGenerationHolder(), getCommittedDocIdLimitRef(), get_initial_alloc()) { setEnum(true); } diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp b/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp index 37b7a82ab55..1f3d43296fe 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp +++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.cpp @@ -8,11 +8,13 @@ namespace search::attribute { -ReferenceMappings::ReferenceMappings(GenerationHolder &genHolder, const std::atomic<uint32_t>& committedDocIdLimit) - : _reverseMappingIndices(vespalib::GrowStrategy(16, 1.0, 0, 0), genHolder), +ReferenceMappings::ReferenceMappings(GenerationHolder& genHolder, + const std::atomic<uint32_t>& committedDocIdLimit, + const vespalib::alloc::Alloc& initial_alloc) + : _reverseMappingIndices(vespalib::GrowStrategy(16, 1.0, 0, 0), genHolder, initial_alloc), _targetLidLimit(0), _reverseMapping(), - _targetLids(vespalib::GrowStrategy(16, 1.0, 0, 0), genHolder), + _targetLids(vespalib::GrowStrategy(16, 1.0, 0, 0), genHolder, initial_alloc), _committedDocIdLimit(committedDocIdLimit) { } diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h index e6bcceeef18..2ccc164bf08 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h +++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h @@ -49,7 +49,8 @@ public: // Class used to map from target lid to source lids using ReverseMappingRefs = vespalib::ConstArrayRef<AtomicEntryRef>; - ReferenceMappings(GenerationHolder &genHolder, const std::atomic<uint32_t>& committedDocIdLimit); + ReferenceMappings(GenerationHolder &genHolder, const std::atomic<uint32_t>& committedDocIdLimit, + const vespalib::alloc::Alloc& initial_alloc); ~ReferenceMappings(); |