aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-04-21 20:51:31 +0200
committerTor Egge <Tor.Egge@online.no>2022-04-21 20:51:31 +0200
commitd5d161ea30459ecb984f22391b1689ab8c0bd557 (patch)
treed224dc7d41e9e2127d961d869c20cd0292e2acce /searchlib
parent9753948560485faf82092ca858384f4dacd6c453 (diff)
Block compaction while buffers are held.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstore.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp7
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h2
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp4
6 files changed, 16 insertions, 4 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
index fa0b8977c8a..1ef194f6812 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
@@ -226,7 +226,7 @@ template <typename EntryT>
std::unique_ptr<IEnumStore::EnumIndexRemapper>
EnumStoreT<EntryT>::consider_compact_values(const CompactionStrategy& compaction_strategy)
{
- if (_compaction_spec.get_values().compact()) {
+ if (!_store.get_data_store().has_held_buffers() && _compaction_spec.get_values().compact()) {
return compact_worst_values(_compaction_spec.get_values(), compaction_strategy);
}
return std::unique_ptr<IEnumStore::EnumIndexRemapper>();
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
index b57269d04c6..61798959f3e 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
@@ -55,7 +55,10 @@ public:
void doneLoadFromMultiValue() { _store.setInitializing(false); }
void compactWorst(CompactionSpec compactionSpec, const CompactionStrategy& compaction_strategy) override;
+private:
+ virtual bool has_held_buffers() const noexcept override;
+public:
vespalib::AddressSpace getAddressSpaceUsage() const override;
vespalib::MemoryUsage getArrayStoreMemoryUsage() const override;
bool has_free_lists_enabled() const { return _store.has_free_lists_enabled(); }
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
index 87ffaa75ace..2a0fb24d70f 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.hpp
@@ -50,6 +50,13 @@ MultiValueMapping<EntryT,RefT>::compactWorst(CompactionSpec compaction_spec, con
}
template <typename EntryT, typename RefT>
+bool
+MultiValueMapping<EntryT,RefT>::has_held_buffers() const noexcept
+{
+ return _store.has_held_buffers();
+}
+
+template <typename EntryT, typename RefT>
vespalib::MemoryUsage
MultiValueMapping<EntryT,RefT>::getArrayStoreMemoryUsage() const
{
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
index 0bcff91007d..1e50124017c 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
@@ -89,7 +89,7 @@ MultiValueMappingBase::updateStat(const CompactionStrategy& compaction_strategy)
bool
MultiValueMappingBase::considerCompact(const CompactionStrategy &compactionStrategy)
{
- if (_compaction_spec.compact()) {
+ if (!has_held_buffers() && _compaction_spec.compact()) {
compactWorst(_compaction_spec, compactionStrategy);
return true;
}
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h
index 8fe64bd62e7..27f2e8f25e3 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.h
@@ -41,6 +41,8 @@ protected:
}
EntryRef acquire_entry_ref(uint32_t docId) const noexcept { return _indices.acquire_elem_ref(docId).load_acquire(); }
+
+ virtual bool has_held_buffers() const noexcept = 0;
public:
using RefCopyVector = vespalib::Array<EntryRef>;
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
index 8327db769d7..0e09118a3f3 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
@@ -555,7 +555,7 @@ HnswIndex::compact_link_arrays(CompactionSpec compaction_spec, const CompactionS
bool
HnswIndex::consider_compact_level_arrays(const CompactionStrategy& compaction_strategy)
{
- if (_compaction_spec.level_arrays().compact()) {
+ if (!_graph.nodes.has_held_buffers() && _compaction_spec.level_arrays().compact()) {
compact_level_arrays(_compaction_spec.level_arrays(), compaction_strategy);
return true;
}
@@ -565,7 +565,7 @@ HnswIndex::consider_compact_level_arrays(const CompactionStrategy& compaction_st
bool
HnswIndex::consider_compact_link_arrays(const CompactionStrategy& compaction_strategy)
{
- if (_compaction_spec.link_arrays().compact()) {
+ if (!_graph.links.has_held_buffers() && _compaction_spec.link_arrays().compact()) {
compact_link_arrays(_compaction_spec.link_arrays(), compaction_strategy);
return true;
}