aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-05-26 13:19:04 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-05-26 13:23:23 +0000
commit9b7fbd40636763509335a93df7d9611441b1ceaf (patch)
tree33aeaa67e495ee42ae29ccbabb72d1e3b604b655 /searchlib
parentfd13f73b5ef66dcc81f60a6319be4f01b5e1d68e (diff)
Inherit from vespalib::GrowStrategy
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp2
-rw-r--r--searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp9
-rw-r--r--searchlib/src/vespa/searchcommon/common/growstrategy.cpp8
-rw-r--r--searchlib/src/vespa/searchcommon/common/growstrategy.h29
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/flagattribute.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/docstore/logdatastore.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp2
15 files changed, 27 insertions, 49 deletions
diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
index ad082b3375a..55266841c67 100644
--- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
+++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
@@ -477,7 +477,7 @@ PostingListAttributeTest::checkPostingList(const VectorType & vec, const std::ve
}
EXPECT_EQ(doc, docEnd);
} else {
- EXPECT_TRUE(has_bitvector && vec.getConfig().getEnableOnlyBitVector());
+ EXPECT_TRUE(has_bitvector && vec.getEnableOnlyBitVector());
numHits = postingList.getBitVectorEntry(find_result.second)->_bv->reader().countTrueBits();
}
if (has_bitvector) {
diff --git a/searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp b/searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp
index 8abe5dcc414..f9e77376b25 100644
--- a/searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp
+++ b/searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp
@@ -102,11 +102,10 @@ TEST("test operator== on attribute config for tensor type")
TEST("Test GrowStrategy consistency") {
GrowStrategy g(1024, 0.5, 17, 3, 0.4f);
- EXPECT_EQUAL(1024u, g.getDocsInitialCapacity());
- EXPECT_EQUAL(50u, g.getDocsGrowPercent());
- EXPECT_EQUAL(0.5, g.getDocsGrowFactor());
- EXPECT_EQUAL(17u, g.getDocsGrowDelta());
- EXPECT_EQUAL(3u, g.getDocsMinimumCapacity());
+ EXPECT_EQUAL(1024u, g.getInitialCapacity());
+ EXPECT_EQUAL(0.5, g.getGrowFactor());
+ EXPECT_EQUAL(17u, g.getGrowDelta());
+ EXPECT_EQUAL(3u, g.getMinimumCapacity());
EXPECT_EQUAL(0.4f, g.getMultiValueAllocGrowFactor());
}
diff --git a/searchlib/src/vespa/searchcommon/common/growstrategy.cpp b/searchlib/src/vespa/searchcommon/common/growstrategy.cpp
index 36c577b1048..27bd5ea904e 100644
--- a/searchlib/src/vespa/searchcommon/common/growstrategy.cpp
+++ b/searchlib/src/vespa/searchcommon/common/growstrategy.cpp
@@ -8,10 +8,10 @@ namespace search {
std::ostream&
operator<<(std::ostream& os, const GrowStrategy& grow_strategy)
{
- os << "{docsInitialCapacity=" << grow_strategy.getDocsInitialCapacity() <<
- ", docsMinimumCapacity=" << grow_strategy.getDocsMinimumCapacity() <<
- ", docsGrowFactor=" << grow_strategy.getDocsGrowFactor() <<
- ", docsGrowDelta=" << grow_strategy.getDocsGrowDelta() <<
+ os << "{docsInitialCapacity=" << grow_strategy.getInitialCapacity() <<
+ ", docsMinimumCapacity=" << grow_strategy.getMinimumCapacity() <<
+ ", docsGrowFactor=" << grow_strategy.getGrowFactor() <<
+ ", docsGrowDelta=" << grow_strategy.getGrowDelta() <<
", multiValueAllocGrowFactor=" << grow_strategy.getMultiValueAllocGrowFactor() <<
"}";
return os;
diff --git a/searchlib/src/vespa/searchcommon/common/growstrategy.h b/searchlib/src/vespa/searchcommon/common/growstrategy.h
index 3320e6ead6e..bc04047aa3c 100644
--- a/searchlib/src/vespa/searchcommon/common/growstrategy.h
+++ b/searchlib/src/vespa/searchcommon/common/growstrategy.h
@@ -8,13 +8,9 @@
namespace search {
-class GrowStrategy
+class GrowStrategy : public vespalib::GrowStrategy
{
private:
- uint32_t _docsInitialCapacity;
- uint32_t _docsMinimumCapacity;
- float _docsGrowFactor;
- uint32_t _docsGrowDelta;
float _multiValueAllocGrowFactor;
public:
GrowStrategy() noexcept
@@ -22,10 +18,7 @@ public:
{}
GrowStrategy(uint32_t docsInitialCapacity, float docsGrowFactor,
uint32_t docsGrowDelta, uint32_t docsMinimumCapacity, float multiValueAllocGrowFactor) noexcept
- : _docsInitialCapacity(docsInitialCapacity),
- _docsMinimumCapacity(docsMinimumCapacity),
- _docsGrowFactor(docsGrowFactor),
- _docsGrowDelta(docsGrowDelta),
+ : vespalib::GrowStrategy(docsInitialCapacity, docsGrowFactor, docsGrowDelta, docsMinimumCapacity),
_multiValueAllocGrowFactor(multiValueAllocGrowFactor)
{
}
@@ -34,25 +27,11 @@ public:
return GrowStrategy(docsInitialCapacity, docsGrowFactor, docsGrowDelta, 0, 0.2);
}
- uint32_t getDocsInitialCapacity() const { return _docsInitialCapacity; }
- uint32_t getDocsMinimumCapacity() const { return _docsMinimumCapacity; }
- uint32_t getDocsGrowPercent() const { return _docsGrowFactor*100; }
- float getDocsGrowFactor() const { return _docsGrowFactor; }
- uint32_t getDocsGrowDelta() const { return _docsGrowDelta; }
float getMultiValueAllocGrowFactor() const { return _multiValueAllocGrowFactor; }
- void setDocsInitialCapacity(uint32_t v) { _docsInitialCapacity = v; }
- void setDocsMinimumCapacity(uint32_t v) { _docsMinimumCapacity = v; }
- void setDocsGrowDelta(uint32_t v) { _docsGrowDelta = v; }
-
- vespalib::GrowStrategy to_generic_strategy() const {
- return vespalib::GrowStrategy(_docsInitialCapacity, _docsGrowFactor, _docsGrowDelta, _docsMinimumCapacity);
- }
bool operator==(const GrowStrategy & rhs) const {
- return _docsInitialCapacity == rhs._docsInitialCapacity &&
- _docsGrowFactor == rhs._docsGrowFactor &&
- _docsGrowDelta == rhs._docsGrowDelta &&
- _multiValueAllocGrowFactor == rhs._multiValueAllocGrowFactor;
+ return vespalib::GrowStrategy::operator==(rhs) &&
+ (_multiValueAllocGrowFactor == rhs._multiValueAllocGrowFactor);
}
bool operator!=(const GrowStrategy & rhs) const {
return !(operator==(rhs));
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 983c4c4ae22..a35fb13b9ff 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -5,7 +5,6 @@
#include "address_space_usage.h"
#include "changevector.h"
#include "readable_attribute_vector.h"
-#include <vespa/searchcommon/attribute/config.h>
#include <vespa/searchcommon/attribute/i_search_context.h>
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/searchcommon/attribute/search_context_params.h>
diff --git a/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp b/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp
index 6e19d35a966..ef796d3f3d2 100644
--- a/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/flagattribute.cpp
@@ -46,7 +46,7 @@ FlagAttributeT<B>::FlagAttributeT(const vespalib::string & baseFileName, const A
_bitVectorHolder(),
_bitVectorStore(256),
_bitVectors(256),
- _bitVectorSize(cfg.getGrowStrategy().getDocsInitialCapacity())
+ _bitVectorSize(cfg.getGrowStrategy().getInitialCapacity())
{
}
@@ -211,7 +211,7 @@ void
FlagAttributeT<B>::resizeBitVectors(uint32_t neededSize)
{
const GrowStrategy & gs = this->getConfig().getGrowStrategy();
- uint32_t newSize = neededSize + (neededSize * gs.getDocsGrowFactor()) + gs.getDocsGrowDelta();
+ uint32_t newSize = neededSize + (neededSize * gs.getGrowFactor()) + gs.getGrowDelta();
for (size_t i(0), m(_bitVectors.size()); i < m; i++) {
BitVector *bv = _bitVectors[i].load_relaxed();
if (bv != nullptr) {
diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp
index 622058550a2..cbe46a8cb2e 100644
--- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.hpp
@@ -6,6 +6,7 @@
#include "raw_multi_value_read_view.h"
#include "copy_multi_value_read_view.h"
#include <vespa/searchlib/attribute/multivalueattribute.h>
+#include <vespa/searchcommon/attribute/config.h>
#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/vespalib/util/memory_allocator.h>
@@ -31,7 +32,7 @@ MultiValueAttribute(const vespalib::string &baseFileName,
8 * 1024,
cfg.getGrowStrategy().getMultiValueAllocGrowFactor(),
multivalueattribute::enable_free_lists),
- cfg.getGrowStrategy().to_generic_strategy(), this->get_memory_allocator())
+ cfg.getGrowStrategy(), this->get_memory_allocator())
{
}
diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
index 56484813828..ae10c07d12f 100644
--- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp
@@ -65,7 +65,7 @@ adjustUpperBound(int32_t arity, int64_t upper_bound) {
SimpleIndexConfig createSimpleIndexConfig(const search::attribute::Config &config) {
return SimpleIndexConfig(config.predicateParams().dense_posting_list_threshold(),
- config.getGrowStrategy().to_generic_strategy());
+ config.getGrowStrategy());
}
} // namespace
@@ -81,8 +81,8 @@ PredicateAttribute::PredicateAttribute(const vespalib::string &base_file_name, c
createSimpleIndexConfig(config), config.predicateParams().arity())),
_lower_bound(adjustLowerBound(config.predicateParams().arity(), config.predicateParams().lower_bound())),
_upper_bound(adjustUpperBound(config.predicateParams().arity(), config.predicateParams().upper_bound())),
- _min_feature(config.getGrowStrategy().to_generic_strategy(), getGenerationHolder()),
- _interval_range_vector(config.getGrowStrategy().to_generic_strategy(), getGenerationHolder()),
+ _min_feature(config.getGrowStrategy(), getGenerationHolder()),
+ _interval_range_vector(config.getGrowStrategy(), getGenerationHolder()),
_max_interval_range(1)
{
}
diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
index 489073e8cb2..9c12293c22a 100644
--- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp
@@ -47,7 +47,7 @@ ReferenceAttribute::ReferenceAttribute(const vespalib::stringref baseFileName)
ReferenceAttribute::ReferenceAttribute(const vespalib::stringref baseFileName, const Config & cfg)
: NotImplementedAttribute(baseFileName, cfg),
_store({}),
- _indices(cfg.getGrowStrategy().to_generic_strategy(), getGenerationHolder()),
+ _indices(cfg.getGrowStrategy(), getGenerationHolder()),
_compaction_spec(),
_gidToLidMapperFactory(),
_referenceMappings(getGenerationHolder(), getCommittedDocIdLimitRef())
diff --git a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
index a5bb901be31..bb45e5dbbf3 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleboolattribute.cpp
@@ -35,7 +35,7 @@ void
SingleBoolAttribute::ensureRoom(DocId docIdLimit) {
if (_bv.writer().capacity() < docIdLimit) {
const GrowStrategy & gs = this->getConfig().getGrowStrategy();
- uint32_t newSize = docIdLimit + (docIdLimit * gs.getDocsGrowFactor()) + gs.getDocsGrowDelta();
+ uint32_t newSize = docIdLimit + (docIdLimit * gs.getGrowFactor()) + gs.getGrowDelta();
bool incGen = _bv.reserve(newSize);
if (incGen) {
incGeneration();
diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp
index e6695ef6c6c..aada952a7c9 100644
--- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.cpp
@@ -15,7 +15,7 @@ using attribute::Config;
SingleValueEnumAttributeBase::
SingleValueEnumAttributeBase(const Config & c, GenerationHolder &genHolder, const vespalib::alloc::Alloc& initial_alloc)
- : _enumIndices(c.getGrowStrategy().to_generic_strategy(), genHolder, initial_alloc)
+ : _enumIndices(c.getGrowStrategy(), genHolder, initial_alloc)
{
}
diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp
index 15f745cf311..7a72572745a 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp
@@ -25,7 +25,7 @@ template <typename B>
SingleValueNumericAttribute<B>::
SingleValueNumericAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & c)
: B(baseFileName, c),
- _data(c.getGrowStrategy().to_generic_strategy(), getGenerationHolder(), this->get_initial_alloc())
+ _data(c.getGrowStrategy(), getGenerationHolder(), this->get_initial_alloc())
{ }
template <typename B>
diff --git a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp
index 3ee2671d7e1..a98b32d705a 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlesmallnumericattribute.cpp
@@ -25,7 +25,7 @@ SingleValueSmallNumericAttribute(const vespalib::string & baseFileName,
_valueShiftShift(valueShiftShift),
_valueShiftMask(valueShiftMask),
_wordShift(wordShift),
- _wordData(c.getGrowStrategy().to_generic_strategy(), getGenerationHolder())
+ _wordData(c.getGrowStrategy(), getGenerationHolder())
{
assert(_valueMask + 1 == (1u << (1u << valueShiftShift)));
assert((_valueShiftMask + 1) * (1u << valueShiftShift) == 8 * sizeof(Word));
diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
index 3c47a5592bc..8531ea66d38 100644
--- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
@@ -66,7 +66,7 @@ LogDataStore::LogDataStore(vespalib::Executor &executor, const vespalib::string
_tune(tune),
_fileHeaderContext(fileHeaderContext),
_genHandler(),
- _lidInfo(growStrategy.to_generic_strategy()),
+ _lidInfo(growStrategy),
_fileChunks(),
_holdFileChunks(),
_active(0),
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
index 4a6dfecb388..c836ac6bd5b 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp
@@ -49,7 +49,7 @@ vespalib::string makeWrongTensorTypeMsg(const ValueType &fieldTensorType, const
TensorAttribute::TensorAttribute(vespalib::stringref name, const Config &cfg, TensorStore &tensorStore)
: NotImplementedAttribute(name, cfg),
- _refVector(cfg.getGrowStrategy().to_generic_strategy(), getGenerationHolder()),
+ _refVector(cfg.getGrowStrategy(), getGenerationHolder()),
_tensorStore(tensorStore),
_is_dense(cfg.tensorType().is_dense()),
_emptyTensor(createEmptyTensor(cfg.tensorType())),