aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-05-24 11:38:57 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-05-24 11:38:57 +0000
commit3d4f037f782e87d13045bdb8b8d78eda49f06267 (patch)
tree59df8cf651dcb6ccc6c2a5e415030f8cc38e7cb8 /searchlib
parent9eb959b0acb6e20c4d076e99d141d6646aa21c87 (diff)
Holding the generation guard is sufficient
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h24
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h2
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: