diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-05-24 16:12:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 16:12:54 +0200 |
commit | 99e57c6c902fb0720b82fa05e7eda7dcab882050 (patch) | |
tree | e14489eccecd61c0452293ae81c7b755d3ae70e1 /searchlib | |
parent | e66424958fc1baf582861959f9471fbccd29a619 (diff) | |
parent | 3d4f037f782e87d13045bdb8b8d78eda49f06267 (diff) |
Merge pull request #27203 from vespa-engine/balder/enough-with-generation-guard
Balder/enough with generation guard
Diffstat (limited to 'searchlib')
3 files changed, 9 insertions, 19 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index 6bab0f278ca..e3a7fdeb2c3 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -440,7 +440,13 @@ private: vespalib::steady_time _nextStatUpdateTime; std::shared_ptr<vespalib::alloc::MemoryAllocator> _memory_allocator; -////// Locking strategy interface. only available from the Guards. + /// Clean up [0, firstUsed> + virtual void reclaim_memory(generation_t oldest_used_gen); + virtual void before_inc_generation(generation_t current_gen); + virtual void onUpdateStat() = 0; + friend class AttributeTest; +public: + ////// Locking strategy interface. /** * Used to guard that a value you reference will always reference * a value. It might not be the same value, but at least it will @@ -448,22 +454,6 @@ private: * the guard is alive. */ GenerationHandler::Guard takeGenerationGuard() { return _genHandler.takeGuard(); } - - /// Clean up [0, firstUsed> - virtual void reclaim_memory(generation_t oldest_used_gen); - virtual void before_inc_generation(generation_t current_gen); - virtual void onUpdateStat() = 0; - /** - * Used to regulate access to critical resources. Apply the - * reader/writer guards. - */ - std::shared_mutex & getEnumLock() { return _enumLock; } - - friend class ComponentGuard<AttributeVector>; - friend class AttributeValueGuard; - friend class AttributeTest; - friend class AttributeManagerTest; -public: bool headerTypeOK(const vespalib::GenericHeader &header) const; bool hasMultiValue() const override final; bool hasWeightedSetType() const override final; diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp index b50a3720ff8..0a5e2e91446 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp @@ -18,7 +18,7 @@ ImportedAttributeVectorReadGuard::ImportedAttributeVectorReadGuard(std::shared_p _imported_attribute(imported_attribute), _targetLids(), _target_docid_limit(0u), - _reference_attribute_guard(imported_attribute.getReferenceAttribute()), + _reference_attribute_guard(imported_attribute.getReferenceAttribute()->takeGenerationGuard()), _target_attribute_guard(imported_attribute.getTargetAttribute()->makeReadGuard(stableEnumGuard)), _reference_attribute(*imported_attribute.getReferenceAttribute()), _target_attribute(*_target_attribute_guard->attribute()) diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h index 5889934fa23..c984725c6e4 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h @@ -96,7 +96,7 @@ private: const ImportedAttributeVector &_imported_attribute; TargetLids _targetLids; uint32_t _target_docid_limit; - AttributeGuard _reference_attribute_guard; + vespalib::GenerationHandler::Guard _reference_attribute_guard; std::unique_ptr<attribute::AttributeReadGuard> _target_attribute_guard; const ReferenceAttribute &_reference_attribute; protected: |