summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-06-21 12:46:34 +0200
committerTor Egge <Tor.Egge@online.no>2023-06-21 12:46:34 +0200
commit999b90346d4d7f359d072c328ca7ac895997852b (patch)
tree8e50abcf207edc66717d0ae1be37545c4fae1d64 /searchlib
parent9bcd67c4d50c0f5dc9df035a5c1c0ffbcc8f0c1c (diff)
Cleanup multi value mapping unit test.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp
index 17e852c8b92..4b01808e855 100644
--- a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp
+++ b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp
@@ -91,21 +91,21 @@ public:
_maxSmallArraySize()
{
}
- void setup(uint32_t maxSmallArraySize, bool enable_free_lists = true) {
- ArrayStoreConfig config(maxSmallArraySize,
+ void setup(uint32_t max_array_store_type_id, bool enable_free_lists = true) {
+ ArrayStoreConfig config(max_array_store_type_id,
ArrayStoreConfig::AllocSpec(0, RefType::offsetSize(), 8_Ki, ALLOC_GROW_FACTOR));
config.enable_free_lists(enable_free_lists);
_mvMapping = std::make_unique<MvMapping>(config, vespalib::GrowStrategy(), std::make_unique<MemoryAllocatorObserver>(_stats));
_attr = std::make_unique<AttributeType>(*_mvMapping);
- _maxSmallArraySize = maxSmallArraySize;
+ _maxSmallArraySize = _mvMapping->get_mapper().get_array_size(max_array_store_type_id);
}
- void setup(uint32_t maxSmallArraySize, size_t min_entries, size_t max_entries, size_t num_entries_for_new_buffer, bool enable_free_lists = true) {
- ArrayStoreConfig config(maxSmallArraySize,
+ void setup(uint32_t max_array_store_type_id, size_t min_entries, size_t max_entries, size_t num_entries_for_new_buffer, bool enable_free_lists = true) {
+ ArrayStoreConfig config(max_array_store_type_id,
ArrayStoreConfig::AllocSpec(min_entries, max_entries, num_entries_for_new_buffer, ALLOC_GROW_FACTOR));
config.enable_free_lists(enable_free_lists);
_mvMapping = std::make_unique<MvMapping>(config, vespalib::GrowStrategy(), std::make_unique<MemoryAllocatorObserver>(_stats));
_attr = std::make_unique<AttributeType>(*_mvMapping);
- _maxSmallArraySize = maxSmallArraySize;
+ _maxSmallArraySize = _mvMapping->get_mapper().get_array_size(max_array_store_type_id);
}
~MappingTestBase() { }
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
index 0725a574aa0..307d1a0d112 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h
@@ -74,6 +74,8 @@ public:
bool has_free_lists_enabled() const { return _store.has_free_lists_enabled(); }
// Set compaction spec. Only used by unit tests.
void set_compaction_spec(vespalib::datastore::CompactionSpec compaction_spec) noexcept { _store.set_compaction_spec(compaction_spec); }
+ // Get type mapper. Only used by unit tests.
+ const ArrayStoreTypeMapper &get_mapper() const noexcept { return _store.get_mapper(); }
static vespalib::datastore::ArrayStoreConfig optimizedConfigForHugePage(size_t max_type_id,