summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-09-29 10:37:03 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-09-29 10:37:03 +0000
commit606796ed3b3bce9953e419effa9365103ca4032d (patch)
tree1d31ebcc2d2b07ed5e8370b176fc46c0d08d4101 /searchlib
parent62928f4d8b7571c4b10fedffc56b762f57b6b2ca (diff)
Alwasy use bitvector for long posting lists.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/bitvector/bitvector_test.cpp49
-rw-r--r--searchlib/src/tests/attribute/posting_store/posting_store_test.cpp16
-rw-r--r--searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp28
-rw-r--r--searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp8
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/config.cpp2
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/config.h16
-rw-r--r--searchlib/src/vespa/searchlib/attribute/configconverter.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postingstore.cpp34
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postingstore.h1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/sourceselector.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domain.cpp20
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/session.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/session.h4
14 files changed, 64 insertions, 134 deletions
diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
index d1dde5ef6ea..7cfe7eaab75 100644
--- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
+++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp
@@ -57,7 +57,6 @@ struct BitVectorTest
make(Config cfg,
const vespalib::string &pref,
bool fastSearch,
- bool enableBitVectors,
bool enableOnlyBitVector,
bool filter);
@@ -65,16 +64,10 @@ struct BitVectorTest
addDocs(const AttributePtr &v, size_t sz);
template <typename VectorType>
- void populate(VectorType &v,
- uint32_t low,
- uint32_t high,
- bool set);
+ void populate(VectorType &v, uint32_t low, uint32_t high, bool set);
template <typename VectorType>
- void populateAll(VectorType &v,
- uint32_t low,
- uint32_t high,
- bool set);
+ void populateAll(VectorType &v, uint32_t low, uint32_t high, bool set);
void
buildTermQuery(std::vector<char> & buffer,
@@ -116,7 +109,6 @@ struct BitVectorTest
void
test(BasicType bt, CollectionType ct, const vespalib::string &pref,
bool fastSearch,
- bool enableBitVectors,
bool enableOnlyBitVector,
bool filter);
@@ -130,8 +122,8 @@ template <typename VectorType>
VectorType &
BitVectorTest::as(AttributePtr &v)
{
- VectorType *res = dynamic_cast<VectorType *>(v.get());
- assert(res != NULL);
+ auto *res = dynamic_cast<VectorType *>(v.get());
+ assert(res != nullptr);
return *res;
}
@@ -249,12 +241,10 @@ BitVectorTest::AttributePtr
BitVectorTest::make(Config cfg,
const vespalib::string &pref,
bool fastSearch,
- bool enableBitVectors,
bool enableOnlyBitVector,
bool filter)
{
cfg.setFastSearch(fastSearch);
- cfg.setEnableBitVectors(enableBitVectors);
cfg.setEnableOnlyBitVector(enableOnlyBitVector);
cfg.setIsFilter(filter);
AttributePtr v = AttributeFactory::createAttribute(pref, cfg);
@@ -458,7 +448,7 @@ BitVectorTest::checkSearch(AttributePtr v,
TermFieldMatchData md;
sc->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
SearchBasePtr sb = sc->createIterator(&md, true);
- checkSearch(v, std::move(sb), md,
+ checkSearch(std::move(v), std::move(sb), md,
expFirstDocId, expLastDocId, expDocFreq, weights,
checkStride);
}
@@ -470,18 +460,17 @@ BitVectorTest::test(BasicType bt,
CollectionType ct,
const vespalib::string &pref,
bool fastSearch,
- bool enableBitVectors,
bool enableOnlyBitVector,
bool filter)
{
Config cfg(bt, ct);
- AttributePtr v = make(cfg, pref, fastSearch, enableBitVectors, enableOnlyBitVector, filter);
+ AttributePtr v = make(cfg, pref, fastSearch, enableOnlyBitVector, filter);
addDocs(v, 1024);
- VectorType &tv = as<VectorType>(v);
+ auto &tv = as<VectorType>(v);
populate(tv, 2, 1023, true);
SearchContextPtr sc = getSearch<VectorType>(tv, true);
- checkSearch(v, std::move(sc), 2, 1022, 205, !enableBitVectors && !filter, true);
+ checkSearch(v, std::move(sc), 2, 1022, 205, !fastSearch && !filter, true);
sc = getSearch<VectorType>(tv, false);
checkSearch(v, std::move(sc), 2, 1022, 205, !enableOnlyBitVector && !filter, true);
const search::IDocumentWeightAttribute *dwa = v->asDocumentWeightAttribute();
@@ -504,13 +493,13 @@ BitVectorTest::test(BasicType bt,
checkSearch(v, std::move(sc), 977, 1022, 10, !enableOnlyBitVector &&!filter, true);
populate(tv, 2, 973, true);
sc = getSearch<VectorType>(tv, true);
- checkSearch(v, std::move(sc), 2, 1022, 205, !enableBitVectors && !filter, true);
+ checkSearch(v, std::move(sc), 2, 1022, 205, !fastSearch && !filter, true);
addDocs(v, 15000);
sc = getSearch<VectorType>(tv, true);
checkSearch(v, std::move(sc), 2, 1022, 205, !enableOnlyBitVector && !filter, true);
populateAll(tv, 10, 15000, true);
sc = getSearch<VectorType>(tv, true);
- checkSearch(v, std::move(sc), 2, 14999, 14992, !enableBitVectors && !filter, false);
+ checkSearch(v, std::move(sc), 2, 14999, 14992, !fastSearch && !filter, false);
}
@@ -519,14 +508,12 @@ void
BitVectorTest::test(BasicType bt, CollectionType ct, const vespalib::string &pref)
{
LOG(info, "test run, pref is %s", pref.c_str());
- test<VectorType, BufferType>(bt, ct, pref, false, false, false, false);
- test<VectorType, BufferType>(bt, ct, pref, false, false, false, true);
- test<VectorType, BufferType>(bt, ct, pref, true, false, false, false);
- test<VectorType, BufferType>(bt, ct, pref, true, false, false, true);
- test<VectorType, BufferType>(bt, ct, pref, true, true, false, false);
- test<VectorType, BufferType>(bt, ct, pref, true, true, false, true);
- test<VectorType, BufferType>(bt, ct, pref, true, true, true, false);
- test<VectorType, BufferType>(bt, ct, pref, true, true, true, true);
+ test<VectorType, BufferType>(bt, ct, pref, false, false, false);
+ test<VectorType, BufferType>(bt, ct, pref, false, false, true);
+ test<VectorType, BufferType>(bt, ct, pref, true, false, false);
+ test<VectorType, BufferType>(bt, ct, pref, true, false, true);
+ test<VectorType, BufferType>(bt, ct, pref, true, true, false);
+ test<VectorType, BufferType>(bt, ct, pref, true, true, true);
}
@@ -605,8 +592,8 @@ TEST_F("Test bitvectors with weighted set value string", BitVectorTest)
class Verifier : public search::test::SearchIteratorVerifier {
public:
- Verifier(bool inverted);
- ~Verifier();
+ explicit Verifier(bool inverted);
+ ~Verifier() override;
SearchIterator::UP create(bool strict) const override {
return BitVectorIterator::create(_bv.get(), getDocIdLimit(), _tfmd, strict, _inverted);
diff --git a/searchlib/src/tests/attribute/posting_store/posting_store_test.cpp b/searchlib/src/tests/attribute/posting_store/posting_store_test.cpp
index 573284ffa35..36babec6a89 100644
--- a/searchlib/src/tests/attribute/posting_store/posting_store_test.cpp
+++ b/searchlib/src/tests/attribute/posting_store/posting_store_test.cpp
@@ -23,28 +23,25 @@ using MyPostingStore = PostingStore<int32_t>;
namespace {
-static constexpr uint32_t lid_limit = 20000;
-static constexpr uint32_t huge_sequence_length = 800;
+constexpr uint32_t lid_limit = 20000;
+constexpr uint32_t huge_sequence_length = 800;
struct PostingStoreSetup {
- bool enable_bitvectors;
bool enable_only_bitvector;
- PostingStoreSetup(bool enable_bitvectors_in, bool enable_only_bitvector_in)
- : enable_bitvectors(enable_bitvectors_in),
- enable_only_bitvector(enable_only_bitvector_in)
+ explicit PostingStoreSetup(bool enable_only_bitvector_in)
+ : enable_only_bitvector(enable_only_bitvector_in)
{
}
};
std::ostream& operator<<(std::ostream& os, const PostingStoreSetup setup)
{
- os << (setup.enable_bitvectors ? "bv" : "nobv") << "_" << (setup.enable_only_bitvector ? "onlybv" : "mixed");
+ os << (setup.enable_only_bitvector ? "onlybv" : "mixed");
return os;
}
Config make_config(PostingStoreSetup param) {
Config cfg;
- cfg.setEnableBitVectors(param.enable_bitvectors);
cfg.setEnableOnlyBitVector(param.enable_only_bitvector);
return cfg;
}
@@ -216,7 +213,6 @@ PostingStoreTest::test_compact_btree_nodes(uint32_t sequence_length)
EXPECT_EQ(make_exp_sequence(5, 5 + sequence_length), get_sequence(ref2));
auto usage_after = store.getMemoryUsage();
if (sequence_length < huge_sequence_length ||
- !_config.getEnableBitVectors() ||
!_config.getEnableOnlyBitVector()) {
EXPECT_GT(usage_before.deadBytes(), usage_after.deadBytes());
} else {
@@ -226,7 +222,7 @@ PostingStoreTest::test_compact_btree_nodes(uint32_t sequence_length)
VESPA_GTEST_INSTANTIATE_TEST_SUITE_P(PostingStoreMultiTest,
PostingStoreTest,
- testing::Values(PostingStoreSetup(false, false), PostingStoreSetup(true, false), PostingStoreSetup(true, true)), testing::PrintToStringParamName());
+ testing::Values(PostingStoreSetup(false), PostingStoreSetup(true)), testing::PrintToStringParamName());
TEST_P(PostingStoreTest, require_that_nodes_for_multiple_small_btrees_are_compacted)
{
diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
index e866c57342e..5ce20c06ab5 100644
--- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
+++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
@@ -155,8 +155,8 @@ protected:
template <typename VectorType, typename BufferType>
void testPostingList(const AttributePtr& ptr1, uint32_t numDocs, const std::vector<BufferType>& values);
void testPostingList();
- void testPostingList(bool enableBitVector, bool enable_only_bitvector);
- void testPostingList(bool enableBitVector, bool enable_only_bitvector, uint32_t numDocs, uint32_t numUniqueValues);
+ void testPostingList(bool enable_only_bitvector);
+ void testPostingList(bool enable_only_bitvector, uint32_t numDocs, uint32_t numUniqueValues);
template <typename AttributeType, typename ValueType>
void checkPostingList(AttributeType & vec, ValueType value, DocSet expected);
@@ -554,7 +554,7 @@ PostingListAttributeTest::testPostingList(const AttributePtr& ptr1, uint32_t num
{
LOG(info, "testPostingList: vector '%s'", ptr1->getName().c_str());
- auto& vec1 = static_cast<VectorType &>(*ptr1.get());
+ auto& vec1 = dynamic_cast<VectorType &>(*ptr1);
addDocs(ptr1, numDocs);
uint32_t part = numDocs / values.size();
@@ -595,20 +595,19 @@ PostingListAttributeTest::testPostingList(const AttributePtr& ptr1, uint32_t num
void
PostingListAttributeTest::testPostingList()
{
- testPostingList(false, false);
- testPostingList(true, false);
- testPostingList(true, true);
+ testPostingList(false);
+ testPostingList(true);
}
void
-PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only_bitvector)
+PostingListAttributeTest::testPostingList(bool enable_only_bitvector)
{
- testPostingList(enableBitVector, enable_only_bitvector, 1000, 50);
- testPostingList(enableBitVector, enable_only_bitvector, 2000, 10); // This should force bitvector
+ testPostingList(enable_only_bitvector, 1000, 50);
+ testPostingList(enable_only_bitvector, 2000, 10); // This should force bitvector
}
void
-PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only_bitvector, uint32_t numDocs, uint32_t numUniqueValues)
+PostingListAttributeTest::testPostingList(bool enable_only_bitvector, uint32_t numDocs, uint32_t numUniqueValues)
{
{ // IntegerAttribute
@@ -619,7 +618,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::INT32, CollectionType::SINGLE));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("sint32", cfg);
testPostingList<Int32PostingListAttribute>(ptr1, numDocs, values);
@@ -627,7 +625,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::INT32, CollectionType::ARRAY));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("aint32", cfg);
testPostingList<Int32ArrayPostingListAttribute>(ptr1, numDocs, values);
@@ -635,7 +632,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::INT32, CollectionType::WSET));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("wsint32", cfg);
testPostingList<Int32WsetPostingListAttribute>(ptr1, numDocs, values);
@@ -650,7 +646,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::FLOAT, CollectionType::SINGLE));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("sfloat", cfg);
testPostingList<FloatPostingListAttribute>(ptr1, numDocs, values);
@@ -658,7 +653,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::FLOAT, CollectionType::ARRAY));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("afloat", cfg);
testPostingList<FloatArrayPostingListAttribute>(ptr1, numDocs, values);
@@ -666,7 +660,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::FLOAT, CollectionType::WSET));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("wsfloat", cfg);
testPostingList<FloatWsetPostingListAttribute>(ptr1, numDocs, values);
@@ -687,7 +680,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::STRING, CollectionType::SINGLE));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("sstr", cfg);
testPostingList<StringPostingListAttribute>(ptr1, numDocs, charValues);
@@ -695,7 +687,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::STRING, CollectionType::ARRAY));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("astr", cfg);
testPostingList<StringArrayPostingListAttribute>(ptr1, numDocs, charValues);
@@ -703,7 +694,6 @@ PostingListAttributeTest::testPostingList(bool enableBitVector, bool enable_only
{
Config cfg(Config(BasicType::STRING, CollectionType::WSET));
cfg.setFastSearch(true);
- cfg.setEnableBitVectors(enableBitVector);
cfg.setEnableOnlyBitVector(enable_only_bitvector);
AttributePtr ptr1 = create_attribute("wsstr", cfg);
testPostingList<StringWsetPostingListAttribute>(ptr1, numDocs, charValues);
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 2183138811b..986848c39b7 100644
--- a/searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp
+++ b/searchlib/src/tests/searchcommon/attribute/config/attribute_config_test.cpp
@@ -31,7 +31,6 @@ TEST_F("test default attribute config", Fixture)
EXPECT_EQUAL(CollectionType::Type::SINGLE,
f._config.collectionType().type());
EXPECT_TRUE(!f._config.fastSearch());
- EXPECT_TRUE(!f._config.getEnableBitVectors());
EXPECT_TRUE(!f._config.getEnableOnlyBitVector());
EXPECT_TRUE(!f._config.getIsFilter());
EXPECT_TRUE(!f._config.fastAccess());
@@ -39,14 +38,11 @@ TEST_F("test default attribute config", Fixture)
}
TEST_F("test integer weightedset attribute config",
- Fixture(BasicType::Type::INT32,
- CollectionType::Type::WSET))
+ Fixture(BasicType::Type::INT32, CollectionType::Type::WSET))
{
EXPECT_EQUAL(BasicType::Type::INT32, f._config.basicType().type());
- EXPECT_EQUAL(CollectionType::Type::WSET,
- f._config.collectionType().type());
+ EXPECT_EQUAL(CollectionType::Type::WSET, f._config.collectionType().type());
EXPECT_TRUE(!f._config.fastSearch());
- EXPECT_TRUE(!f._config.getEnableBitVectors());
EXPECT_TRUE(!f._config.getEnableOnlyBitVector());
EXPECT_TRUE(!f._config.getIsFilter());
EXPECT_TRUE(!f._config.fastAccess());
diff --git a/searchlib/src/vespa/searchcommon/attribute/config.cpp b/searchlib/src/vespa/searchcommon/attribute/config.cpp
index 69dab6ad88e..70c2377289f 100644
--- a/searchlib/src/vespa/searchcommon/attribute/config.cpp
+++ b/searchlib/src/vespa/searchcommon/attribute/config.cpp
@@ -19,7 +19,6 @@ Config::Config(BasicType bt, CollectionType ct, bool fastSearch_) noexcept
: _basicType(bt),
_type(ct),
_fastSearch(fastSearch_),
- _enableBitVectors(false),
_enableOnlyBitVector(false),
_isFilter(false),
_fastAccess(false),
@@ -49,7 +48,6 @@ Config::operator==(const Config &b) const
return _basicType == b._basicType &&
_type == b._type &&
_fastSearch == b._fastSearch &&
- _enableBitVectors == b._enableBitVectors &&
_enableOnlyBitVector == b._enableOnlyBitVector &&
_isFilter == b._isFilter &&
_fastAccess == b._fastAccess &&
diff --git a/searchlib/src/vespa/searchcommon/attribute/config.h b/searchlib/src/vespa/searchcommon/attribute/config.h
index edd5dbcc7a1..0102f362532 100644
--- a/searchlib/src/vespa/searchcommon/attribute/config.h
+++ b/searchlib/src/vespa/searchcommon/attribute/config.h
@@ -44,12 +44,6 @@ public:
const std::optional<HnswIndexParams>& hnsw_index_params() const { return _hnsw_index_params; }
/**
- * Check if attribute posting list can consist of a bitvector in
- * addition to (or instead of) a btree.
- */
- bool getEnableBitVectors() const { return _enableBitVectors; }
-
- /**
* Check if attribute posting list can consist of only a bitvector with
* no corresponding btree.
*/
@@ -89,15 +83,6 @@ public:
}
/**
- * Enable attribute posting list to consist of a bitvector in
- * addition to (or instead of) a btree.
- */
- Config & setEnableBitVectors(bool enableBitVectors) {
- _enableBitVectors = enableBitVectors;
- return *this;
- }
-
- /**
* Enable attribute posting list to consist of only a bitvector with
* no corresponding btree. Some information degradation might occur when
* document frequency goes down, since recreated btree representation
@@ -132,7 +117,6 @@ private:
BasicType _basicType;
CollectionType _type;
bool _fastSearch;
- bool _enableBitVectors;
bool _enableOnlyBitVector;
bool _isFilter;
bool _fastAccess;
diff --git a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp
index ed7d5abb8f8..894ede513a2 100644
--- a/searchlib/src/vespa/searchlib/attribute/configconverter.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/configconverter.cpp
@@ -46,8 +46,8 @@ getCollectionTypeMap()
return map;
}
-static DataTypeMap _dataTypeMap = getDataTypeMap();
-static CollectionTypeMap _collectionTypeMap = getCollectionTypeMap();
+DataTypeMap _dataTypeMap = getDataTypeMap();
+CollectionTypeMap _collectionTypeMap = getCollectionTypeMap();
DictionaryConfig::Type
convert(AttributesConfig::Attribute::Dictionary::Type type_cfg) {
@@ -77,7 +77,7 @@ convert(AttributesConfig::Attribute::Dictionary::Match match_cfg) {
DictionaryConfig
convert_dictionary(const AttributesConfig::Attribute::Dictionary & dictionary) {
- return DictionaryConfig(convert(dictionary.type), convert(dictionary.match));
+ return {convert(dictionary.type), convert(dictionary.match)};
}
Config::Match
@@ -103,7 +103,6 @@ ConfigConverter::convert(const AttributesConfig::Attribute & cfg)
Config retval(bType, cType);
PredicateParams predicateParams;
retval.setFastSearch(cfg.fastsearch);
- retval.setEnableBitVectors(cfg.enablebitvectors);
retval.setEnableOnlyBitVector(cfg.enableonlybitvector);
retval.setIsFilter(cfg.enableonlybitvector);
retval.setFastAccess(cfg.fastaccess);
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
index 79276ce6f55..6ef3b575c3e 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
@@ -128,9 +128,6 @@ PostingListAttributeBase<P>::forwardedOnAddDoc(DocId doc,
size_t wantSize,
size_t wantCapacity)
{
- if (!_postingList._enableBitVectors) {
- return false;
- }
if (doc >= wantSize) {
wantSize = doc + 1;
}
diff --git a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp
index 1b296f7d03e..79ec976ac50 100644
--- a/searchlib/src/vespa/searchlib/attribute/postingstore.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postingstore.cpp
@@ -17,17 +17,8 @@ namespace search::attribute {
using vespalib::btree::BTreeNoLeafData;
using vespalib::datastore::EntryRefFilter;
-// #define FORCE_BITVECTORS
-
-
PostingStoreBase2::PostingStoreBase2(IEnumStoreDictionary& dictionary, Status &status, const Config &config)
- :
-#ifdef FORCE_BITVECTORS
- _enableBitVectors(true),
-#else
- _enableBitVectors(config.getEnableBitVectors()),
-#endif
- _enableOnlyBitVector(config.getEnableOnlyBitVector()),
+ : _enableOnlyBitVector(config.getEnableOnlyBitVector()),
_isFilter(config.getIsFilter()),
_bvSize(64u),
_bvCapacity(128u),
@@ -101,7 +92,7 @@ PostingStore<DataT>::removeSparseBitVectors()
(void) typeId;
assert(isBitVector(typeId));
BitVectorEntry *bve = getWBitVectorEntry(iRef);
- GrowableBitVector &bv = *bve->_bv.get();
+ GrowableBitVector &bv = *bve->_bv;
uint32_t docFreq = bv.writer().countTrueBits();
if (bve->_tree.valid()) {
RefType iRef2(bve->_tree);
@@ -175,9 +166,7 @@ PostingStore<DataT>::consider_remove_sparse_bitvector(std::vector<EntryRef>& ref
template <typename DataT>
void
-PostingStore<DataT>::applyNew(EntryRef &ref,
- AddIter a,
- AddIter ae)
+PostingStore<DataT>::applyNew(EntryRef &ref, AddIter a, AddIter ae)
{
// No old data
assert(!ref.valid());
@@ -185,7 +174,7 @@ PostingStore<DataT>::applyNew(EntryRef &ref,
uint32_t clusterSize = additionSize;
if (clusterSize <= clusterLimit) {
applyNewArray(ref, a, ae);
- } else if (_enableBitVectors && clusterSize >= _maxBvDocFreq) {
+ } else if (clusterSize >= _maxBvDocFreq) {
applyNewBitVector(ref, a, ae);
} else {
applyNewTree(ref, a, ae, CompareT());
@@ -292,12 +281,9 @@ PostingStore<DataT>::makeBitVector(EntryRef &ref)
template <typename DataT>
void
-PostingStore<DataT>::applyNewBitVector(EntryRef &ref,
- AddIter aOrg,
- AddIter ae)
+PostingStore<DataT>::applyNewBitVector(EntryRef &ref, AddIter aOrg, AddIter ae)
{
assert(!ref.valid());
- RefType iRef(ref);
vespalib::GenerationHolder &genHolder = _store.getGenerationHolder();
auto bvsp = std::make_shared<GrowableBitVector>(_bvSize, _bvCapacity, genHolder);
BitVector &bv = bvsp->writer();
@@ -410,12 +396,10 @@ PostingStore<DataT>::apply(EntryRef &ref,
} else {
BTreeType *tree = getWTreeEntry(iRef);
applyTree(tree, a, ae, r, re, CompareT());
- if (_enableBitVectors) {
- uint32_t docFreq = tree->size(_allocator);
- if (docFreq >= _maxBvDocFreq) {
- makeBitVector(ref);
- return;
- }
+ uint32_t docFreq = tree->size(_allocator);
+ if (docFreq >= _maxBvDocFreq) {
+ makeBitVector(ref);
+ return;
}
normalizeTree(ref, tree, wasArray);
}
diff --git a/searchlib/src/vespa/searchlib/attribute/postingstore.h b/searchlib/src/vespa/searchlib/attribute/postingstore.h
index 6512c59fa79..aabe5840618 100644
--- a/searchlib/src/vespa/searchlib/attribute/postingstore.h
+++ b/searchlib/src/vespa/searchlib/attribute/postingstore.h
@@ -37,7 +37,6 @@ public:
class PostingStoreBase2
{
public:
- bool _enableBitVectors;
bool _enableOnlyBitVector;
bool _isFilter;
protected:
diff --git a/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp b/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp
index 0a39e5defc9..26a98f488ac 100644
--- a/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp
@@ -100,7 +100,7 @@ SourceSelector::LoadInfo::load()
SourceSelector::SourceSelector(Source defaultSource, AttributeVector::SP realSource) :
ISourceSelector(defaultSource),
- _realSource(realSource)
+ _realSource(std::move(realSource))
{ }
SourceSelector::SaveInfo::UP
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
index 0af1ffa7b33..a0ee40e6674 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
@@ -196,7 +196,7 @@ Domain::getSynced() const
if (_parts.empty()) {
return s;
}
- DomainPartList::const_iterator it(_parts.end());
+ auto it(_parts.end());
--it;
s = it->second->getSynced();
if (s == 0 && it != _parts.begin()) {
@@ -224,9 +224,9 @@ DomainPart::SP
Domain::findPart(SerialNum s)
{
std::lock_guard guard(_partsMutex);
- DomainPartList::iterator it(_parts.upper_bound(s));
+ auto it(_parts.upper_bound(s));
if (!_parts.empty() && it != _parts.begin()) {
- DomainPartList::iterator prev(it);
+ auto prev(it);
--prev;
if (prev->second->range().to() > s) {
return prev->second;
@@ -235,7 +235,7 @@ Domain::findPart(SerialNum s)
if (it != _parts.end()) {
return it->second;
}
- return DomainPart::SP();
+ return {};
}
DomainPart::SP
@@ -282,7 +282,7 @@ Domain::cleanSessions()
return;
}
std::lock_guard guard(_sessionMutex);
- for (SessionList::iterator it(_sessions.begin()), mt(_sessions.end()); it != mt; ) {
+ for (auto it(_sessions.begin()), mt(_sessions.end()); it != mt; ) {
Session * session(it->second.get());
if (session->inSync()) {
_sessions.erase(it++);
@@ -334,7 +334,7 @@ Domain::startCommit(DoneCallback onDone) {
commitChunk(std::move(completed), guard);
return result;
}
- return CommitResult();
+ return {};
}
void
@@ -397,7 +397,7 @@ Domain::erase(SerialNum to)
bool retval(true);
/// Do not erase the last element
UniqueLock guard(_partsMutex);
- for (DomainPartList::iterator it(_parts.begin()); (_parts.size() > 1) && (it->second.get()->range().to() < to); it = _parts.begin()) {
+ for (auto it(_parts.begin()); (_parts.size() > 1) && (it->second->range().to() < to); it = _parts.begin()) {
DomainPart::SP dp(it->second);
_parts.erase(it);
guard.unlock();
@@ -429,7 +429,7 @@ Domain::startSession(int sessionId)
{
int retval(-1);
std::lock_guard guard(_sessionMutex);
- SessionList::iterator found = _sessions.find(sessionId);
+ auto found = _sessions.find(sessionId);
if (found != _sessions.end()) {
found->second->setStartTime(vespalib::steady_clock::now());
if ( _executor.execute(Session::createTask(found->second)).get() == nullptr ) {
@@ -448,7 +448,7 @@ Domain::closeSession(int sessionId)
DurationSeconds sessionRunTime(0);
{
std::lock_guard guard(_sessionMutex);
- SessionList::iterator found = _sessions.find(sessionId);
+ auto found = _sessions.find(sessionId);
if (found != _sessions.end()) {
sessionRunTime = (vespalib::steady_clock::now() - found->second->getStartTime());
retval = 1;
@@ -457,7 +457,7 @@ Domain::closeSession(int sessionId)
while (retval == 1) {
std::this_thread::sleep_for(10ms);
std::lock_guard guard(_sessionMutex);
- SessionList::iterator found = _sessions.find(sessionId);
+ auto found = _sessions.find(sessionId);
if (found != _sessions.end()) {
if ( ! found->second->isVisitRunning()) {
_sessions.erase(sessionId);
diff --git a/searchlib/src/vespa/searchlib/transactionlog/session.cpp b/searchlib/src/vespa/searchlib/transactionlog/session.cpp
index b913110f974..b11f4027ae7 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/session.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/session.cpp
@@ -12,13 +12,13 @@ LOG_SETUP(".transactionlog.session");
namespace search::transactionlog {
vespalib::Executor::Task::UP
-Session::createTask(const Session::SP & session)
+Session::createTask(Session::SP session)
{
- return std::make_unique<VisitTask>(session);
+ return std::make_unique<VisitTask>(std::move(session));
}
-Session::VisitTask::VisitTask(const Session::SP & session)
- : _session(session)
+Session::VisitTask::VisitTask(Session::SP session)
+ : _session(std::move(session))
{
_session->startVisit();
}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/session.h b/searchlib/src/vespa/searchlib/transactionlog/session.h
index 3e55387b81c..9565a1d617f 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/session.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/session.h
@@ -29,14 +29,14 @@ public:
int id() const { return _id; }
bool inSync() const { return _inSync; }
bool finished() const;
- static Task::UP createTask(const Session::SP & session);
+ static Task::UP createTask(Session::SP session);
void setStartTime(steady_time startTime) { _startTime = startTime; }
steady_time getStartTime() const { return _startTime; }
bool isVisitRunning() const { return _visitRunning; }
private:
class VisitTask : public Task {
public:
- VisitTask(const Session::SP & session);
+ VisitTask(Session::SP session);
~VisitTask();
private:
void run() override;