diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-08-28 15:42:52 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-08-29 10:22:06 +0200 |
commit | 57097c2a35d0a38b955075091efe52ce3be63950 (patch) | |
tree | 01ba6867fd1049c46f0c19efadeec90efe78350b /searchlib/src | |
parent | a3f3169824355f8b9b6bd2c08c8bb3c0c449eb09 (diff) |
Block multiple load calls for same attribute vector.
Diffstat (limited to 'searchlib/src')
5 files changed, 105 insertions, 129 deletions
diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp index bd1cfd45280..4e520e86707 100644 --- a/searchlib/src/tests/attribute/attribute_test.cpp +++ b/searchlib/src/tests/attribute/attribute_test.cpp @@ -126,6 +126,16 @@ createAttribute(stringref attrName, const search::attribute::Config &cfg) return search::AttributeFactory::createAttribute(baseFileName(attrName), cfg); } +vespalib::string +replace_suffix(AttributeVector &v, const vespalib::string &suffix) +{ + vespalib::string name = v.getName(); + if (name.size() >= suffix.size()) { + name.resize(name.size() - suffix.size()); + } + return name + suffix; +} + } namespace search { @@ -147,14 +157,14 @@ private: template <typename VectorType, typename BufferType> void compare(VectorType & a, VectorType & b); - void testReloadInt(const AttributePtr & a, const AttributePtr & b, const AttributePtr & c, size_t numDocs); - void testReloadString(const AttributePtr & a, const AttributePtr & b, const AttributePtr & c, size_t numDocs); + void testReloadInt(const AttributePtr & a, size_t numDocs); + void testReloadString(const AttributePtr & a, size_t numDocs); template <typename VectorType, typename BufferType> - void testReload(const AttributePtr & a, const AttributePtr & b, const AttributePtr & c); - void testMemorySaverInt(const AttributePtr & a, const AttributePtr & b, size_t numDocs); - void testMemorySaverString(const AttributePtr & a, const AttributePtr & b, size_t numDocs); + void testReload(const AttributePtr & a); + void testMemorySaverInt(const AttributePtr & a, size_t numDocs); + void testMemorySaverString(const AttributePtr & a, size_t numDocs); template <typename VectorType, typename BufferType> - void testMemorySaver(const AttributePtr & a, const AttributePtr & b); + void testMemorySaver(const AttributePtr & a); void testReload(); void testHasLoadData(); @@ -406,40 +416,37 @@ void AttributeTest::compare(VectorType & a, VectorType & b) delete [] av; } -void AttributeTest::testReloadInt(const AttributePtr & a, const AttributePtr & b, const AttributePtr & c, size_t numDocs) +void AttributeTest::testReloadInt(const AttributePtr & a, size_t numDocs) { addDocs(a, numDocs); - addDocs(b, numDocs); populate(static_cast<IntegerAttribute &>(*a.get()), 17); - populate(static_cast<IntegerAttribute &>(*b.get()), 17); if (a->hasWeightedSetType()) { - testReload<IntegerAttribute, IntegerAttribute::WeightedInt>(a, b, c); + testReload<IntegerAttribute, IntegerAttribute::WeightedInt>(a); } else { - testReload<IntegerAttribute, IntegerAttribute::largeint_t>(a, b, c); + testReload<IntegerAttribute, IntegerAttribute::largeint_t>(a); } } -void AttributeTest::testReloadString(const AttributePtr & a, const AttributePtr & b, const AttributePtr & c, size_t numDocs) +void AttributeTest::testReloadString(const AttributePtr & a, size_t numDocs) { addDocs(a, numDocs); - addDocs(b, numDocs); populate(static_cast<StringAttribute &>(*a.get()), 17); - populate(static_cast<StringAttribute &>(*b.get()), 17); if (a->hasWeightedSetType()) { - testReload<StringAttribute, StringAttribute::WeightedString>(a, b, c); + testReload<StringAttribute, StringAttribute::WeightedString>(a); } else { - testReload<StringAttribute, string>(a, b, c); + testReload<StringAttribute, string>(a); } } template <typename VectorType, typename BufferType> -void AttributeTest::testReload(const AttributePtr & a, const AttributePtr & b, const AttributePtr & c) +void AttributeTest::testReload(const AttributePtr & a) { LOG(info, "testReload: vector '%s'", a->getName().c_str()); - compare<VectorType, BufferType> - (*(static_cast<VectorType *>(a.get())), *(static_cast<VectorType *>(b.get()))); + auto b = createAttribute(replace_suffix(*a, "2"), a->getConfig()); + auto c = createAttribute(replace_suffix(*a, "3"), a->getConfig()); + a->setCreateSerialNum(43u); EXPECT_TRUE( a->save(b->getBaseFileName()) ); a->commit(true); @@ -479,134 +486,102 @@ void AttributeTest::testReload() // CollectionType::SINGLE { AttributePtr iv1 = createAttribute("sint32_1", Config(BasicType::INT32, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("sint32_2", Config(BasicType::INT32, CollectionType::SINGLE)); - AttributePtr iv3 = createAttribute("sint32_3", Config(BasicType::INT32, CollectionType::SINGLE)); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } { AttributePtr iv1 = createAttribute("suint4_1", Config(BasicType::UINT4, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("suint4_2", Config(BasicType::UINT4, CollectionType::SINGLE)); - AttributePtr iv3 = createAttribute("suint4_3", Config(BasicType::UINT4, CollectionType::SINGLE)); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } { AttributePtr iv1 = createAttribute("suint2_1", Config(BasicType::UINT2, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("suint2_2", Config(BasicType::UINT2, CollectionType::SINGLE)); - AttributePtr iv3 = createAttribute("suint2_3", Config(BasicType::UINT2, CollectionType::SINGLE)); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } { AttributePtr iv1 = createAttribute("suint1_1", Config(BasicType::BOOL, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("suint1_2", Config(BasicType::BOOL, CollectionType::SINGLE)); - AttributePtr iv3 = createAttribute("suint1_3", Config(BasicType::BOOL, CollectionType::SINGLE)); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } { Config cfg(BasicType::INT32, CollectionType::SINGLE); cfg.setFastSearch(true); AttributePtr iv1 = createAttribute("sfsint32_1", cfg); - AttributePtr iv2 = createAttribute("sfsint32_2", cfg); - AttributePtr iv3 = createAttribute("sfsint32_3", cfg); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } // CollectionType::ARRAY { Config cfg(BasicType::INT8, CollectionType::ARRAY); cfg.setFastSearch(true); AttributePtr iv1 = createAttribute("flag_1", cfg); - AttributePtr iv2 = createAttribute("flag_2", cfg); - AttributePtr iv3 = createAttribute("flag_3", cfg); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } { AttributePtr iv1 = createAttribute("aint32_1", Config(BasicType::INT32, CollectionType::ARRAY)); - AttributePtr iv2 = createAttribute("aint32_2", Config(BasicType::INT32, CollectionType::ARRAY)); - AttributePtr iv3 = createAttribute("aint32_3", Config(BasicType::INT32, CollectionType::ARRAY)); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } { Config cfg(BasicType::INT32, CollectionType::ARRAY); cfg.setFastSearch(true); AttributePtr iv1 = createAttribute("afsint32_1", cfg); - AttributePtr iv2 = createAttribute("afsint32_2", cfg); - AttributePtr iv3 = createAttribute("afsint32_3", cfg); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } // CollectionType::WSET { AttributePtr iv1 = createAttribute("wint32_1", Config(BasicType::INT32, CollectionType::WSET)); - AttributePtr iv2 = createAttribute("wint32_2", Config(BasicType::INT32, CollectionType::WSET)); - AttributePtr iv3 = createAttribute("wint32_3", Config(BasicType::INT32, CollectionType::WSET)); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } { Config cfg(BasicType::INT32, CollectionType::WSET); cfg.setFastSearch(true); AttributePtr iv1 = createAttribute("wfsint32_1", cfg); - AttributePtr iv2 = createAttribute("wfsint32_2", cfg); - AttributePtr iv3 = createAttribute("wfsint32_3", cfg); - testReloadInt(iv1, iv2, iv3, 0); - testReloadInt(iv1, iv2, iv3, 100); + testReloadInt(iv1, 0); + testReloadInt(iv1, 100); } // StringAttribute { AttributePtr iv1 = createAttribute("sstring_1", Config(BasicType::STRING, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("sstring_2", Config(BasicType::STRING, CollectionType::SINGLE)); - AttributePtr iv3 = createAttribute("sstring_3", Config(BasicType::STRING, CollectionType::SINGLE)); - testReloadString(iv1, iv2, iv3, 0); - testReloadString(iv1, iv2, iv3, 100); + testReloadString(iv1, 0); + testReloadString(iv1, 100); } { AttributePtr iv1 = createAttribute("astring_1", Config(BasicType::STRING, CollectionType::ARRAY)); - AttributePtr iv2 = createAttribute("astring_2", Config(BasicType::STRING, CollectionType::ARRAY)); - AttributePtr iv3 = createAttribute("astring_3", Config(BasicType::STRING, CollectionType::ARRAY)); - testReloadString(iv1, iv2, iv3, 0); - testReloadString(iv1, iv2, iv3, 100); + testReloadString(iv1, 0); + testReloadString(iv1, 100); } { AttributePtr iv1 = createAttribute("wstring_1", Config(BasicType::STRING, CollectionType::WSET)); - AttributePtr iv2 = createAttribute("wstring_2", Config(BasicType::STRING, CollectionType::WSET)); - AttributePtr iv3 = createAttribute("wstring_3", Config(BasicType::STRING, CollectionType::WSET)); - testReloadString(iv1, iv2, iv3, 0); - testReloadString(iv1, iv2, iv3, 100); + testReloadString(iv1, 0); + testReloadString(iv1, 100); } { Config cfg(Config(BasicType::STRING, CollectionType::SINGLE)); cfg.setFastSearch(true); AttributePtr iv1 = createAttribute("sfsstring_1", cfg); - AttributePtr iv2 = createAttribute("sfsstring_2", cfg); - AttributePtr iv3 = createAttribute("sfsstring_3", cfg); - testReloadString(iv1, iv2, iv3, 0); - testReloadString(iv1, iv2, iv3, 100); + testReloadString(iv1, 0); + testReloadString(iv1, 100); } { Config cfg(Config(BasicType::STRING, CollectionType::ARRAY)); cfg.setFastSearch(true); AttributePtr iv1 = createAttribute("afsstring_1", cfg); - AttributePtr iv2 = createAttribute("afsstring_2", cfg); - AttributePtr iv3 = createAttribute("afsstring_3", cfg); - testReloadString(iv1, iv2, iv3, 0); - testReloadString(iv1, iv2, iv3, 100); + testReloadString(iv1, 0); + testReloadString(iv1, 100); } { Config cfg(Config(BasicType::STRING, CollectionType::WSET)); cfg.setFastSearch(true); AttributePtr iv1 = createAttribute("wsfsstring_1", cfg); - AttributePtr iv2 = createAttribute("wsfsstring_2", cfg); - AttributePtr iv3 = createAttribute("wsfsstring_3", cfg); - testReloadString(iv1, iv2, iv3, 0); - testReloadString(iv1, iv2, iv3, 100); + testReloadString(iv1, 0); + testReloadString(iv1, 100); } } @@ -644,35 +619,36 @@ void AttributeTest::testHasLoadData() } void -AttributeTest::testMemorySaverInt(const AttributePtr & a, const AttributePtr & b, size_t numDocs) +AttributeTest::testMemorySaverInt(const AttributePtr & a, size_t numDocs) { addDocs(a, numDocs); populate(static_cast<IntegerAttribute &>(*a.get()), 21); if (a->hasWeightedSetType()) { - testMemorySaver<IntegerAttribute, IntegerAttribute::WeightedInt>(a, b); + testMemorySaver<IntegerAttribute, IntegerAttribute::WeightedInt>(a); } else { - testMemorySaver<IntegerAttribute, IntegerAttribute::largeint_t>(a, b); + testMemorySaver<IntegerAttribute, IntegerAttribute::largeint_t>(a); } } void -AttributeTest::testMemorySaverString(const AttributePtr & a, const AttributePtr & b, size_t numDocs) +AttributeTest::testMemorySaverString(const AttributePtr & a, size_t numDocs) { addDocs(a, numDocs); populate(static_cast<StringAttribute &>(*a.get()), 21); if (a->hasWeightedSetType()) { - testMemorySaver<StringAttribute, StringAttribute::WeightedString>(a, b); + testMemorySaver<StringAttribute, StringAttribute::WeightedString>(a); } else { - testMemorySaver<StringAttribute, string>(a, b); + testMemorySaver<StringAttribute, string>(a); } } template <typename VectorType, typename BufferType> void -AttributeTest::testMemorySaver(const AttributePtr & a, const AttributePtr & b) +AttributeTest::testMemorySaver(const AttributePtr & a) { LOG(info, "testMemorySaver: vector '%s'", a->getName().c_str()); + auto b = createAttribute(replace_suffix(*a, "2ms"), a->getConfig()); AttributeMemorySaveTarget saveTarget; EXPECT_TRUE(a->save(saveTarget, b->getBaseFileName())); FastOS_StatInfo statInfo; @@ -692,40 +668,33 @@ AttributeTest::testMemorySaver() // CollectionType::SINGLE { AttributePtr iv1 = createAttribute("sint32_1ms", Config(BasicType::INT32, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("sint32_2ms", Config(BasicType::INT32, CollectionType::SINGLE)); - testMemorySaverInt(iv1, iv2, 100); + testMemorySaverInt(iv1, 100); } { AttributePtr iv1 = createAttribute("suint4_1ms", Config(BasicType::UINT4, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("suint4_2ms", Config(BasicType::UINT4, CollectionType::SINGLE)); - testMemorySaverInt(iv1, iv2, 100); + testMemorySaverInt(iv1, 100); } { AttributePtr iv1 = createAttribute("sstr_1ms", Config(BasicType::STRING, CollectionType::SINGLE)); - AttributePtr iv2 = createAttribute("sstr_2ms", Config(BasicType::STRING, CollectionType::SINGLE)); - testMemorySaverString(iv1, iv2, 100); + testMemorySaverString(iv1, 100); } // CollectionType::ARRAY { AttributePtr iv1 = createAttribute("aint32_1ms", Config(BasicType::INT32, CollectionType::ARRAY)); - AttributePtr iv2 = createAttribute("aint32_2ms", Config(BasicType::INT32, CollectionType::ARRAY)); - testMemorySaverInt(iv1, iv2, 100); + testMemorySaverInt(iv1, 100); } { AttributePtr iv1 = createAttribute("astr_1ms", Config(BasicType::STRING, CollectionType::ARRAY)); - AttributePtr iv2 = createAttribute("astr_2ms", Config(BasicType::STRING, CollectionType::ARRAY)); - testMemorySaverString(iv1, iv2, 100); + testMemorySaverString(iv1, 100); } // CollectionType::WSET { AttributePtr iv1 = createAttribute("wint32_1ms", Config(BasicType::INT32, CollectionType::WSET)); - AttributePtr iv2 = createAttribute("wint32_2ms", Config(BasicType::INT32, CollectionType::WSET)); - testMemorySaverInt(iv1, iv2, 100); + testMemorySaverInt(iv1, 100); } { AttributePtr iv1 = createAttribute("wstr_1ms", Config(BasicType::STRING, CollectionType::WSET)); - AttributePtr iv2 = createAttribute("wstr_2ms", Config(BasicType::STRING, CollectionType::WSET)); - testMemorySaverString(iv1, iv2, 100); + testMemorySaverString(iv1, 100); } } diff --git a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp index 785f8f03737..e8e55acf117 100644 --- a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp +++ b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp @@ -150,7 +150,7 @@ private: void load(AttributePtr v, const vespalib::string &name); template <typename VectorType, typename BufferType> - void checkLoad(AttributePtr v, const vespalib::string &name, AttributePtr ev); + AttributePtr checkLoad(Config cfg, const vespalib::string &name, AttributePtr ev); template <typename VectorType, typename BufferType> void testReload(AttributePtr v0, AttributePtr v1, AttributePtr v2, @@ -564,13 +564,14 @@ EnumeratedSaveTest::load(AttributePtr v, const vespalib::string &name) } template <typename VectorType, typename BufferType> -void -EnumeratedSaveTest::checkLoad(AttributePtr v, const vespalib::string &name, +EnumeratedSaveTest::AttributePtr +EnumeratedSaveTest::checkLoad(Config cfg, const vespalib::string &name, AttributePtr ev) { - v->setBaseFileName(name); + AttributePtr v = AttributeFactory::createAttribute(name, cfg); EXPECT_TRUE(v->load()); compare<VectorType, BufferType>(as<VectorType>(v), as<VectorType>(ev)); + return v; } @@ -600,27 +601,29 @@ EnumeratedSaveTest::testReload(AttributePtr v0, !flagAttr; - AttributePtr v = make(cfg, pref, fastSearch); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "0", v0))); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "1", v1))); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "2", v2))); + Config check_cfg(cfg); + check_cfg.setFastSearch(fastSearch); + TEST_DO((checkLoad<VectorType, BufferType>(check_cfg, pref + "0", v0))); + TEST_DO((checkLoad<VectorType, BufferType>(check_cfg, pref + "1", v1))); + TEST_DO((checkLoad<VectorType, BufferType>(check_cfg, pref + "2", v2))); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "0", v0))); + AttributePtr v; + TEST_DO((v = checkLoad<VectorType, BufferType>(check_cfg, pref + "0", v0))); TEST_DO(checkMem(*v, supportsEnumerated ? *emv0 : *mv0)); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "1", v1))); + TEST_DO((v = checkLoad<VectorType, BufferType>(check_cfg, pref + "1", v1))); TEST_DO(checkMem(*v, supportsEnumerated ? *emv1 : *mv1)); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "2", v2))); + TEST_DO((v = checkLoad<VectorType, BufferType>(check_cfg, pref + "2", v2))); TEST_DO(checkMem(*v, supportsEnumerated ? *emv2 : *mv2)); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "0_e", v0))); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "1_e", v1))); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "2_e", v2))); + TEST_DO((checkLoad<VectorType, BufferType>(check_cfg, pref + "0_e", v0))); + TEST_DO((checkLoad<VectorType, BufferType>(check_cfg, pref + "1_e", v1))); + TEST_DO((checkLoad<VectorType, BufferType>(check_cfg, pref + "2_e", v2))); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "0_e", v0))); + TEST_DO((v = checkLoad<VectorType, BufferType>(check_cfg, pref + "0_e", v0))); TEST_DO(checkMem(*v, supportsEnumerated ? *emv0 : *mv0)); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "1_e", v1))); + TEST_DO((v = checkLoad<VectorType, BufferType>(check_cfg, pref + "1_e", v1))); TEST_DO(checkMem(*v, supportsEnumerated ? *emv1 : *mv1)); - TEST_DO((checkLoad<VectorType, BufferType>(v, pref + "2_e", v2))); + TEST_DO((v = checkLoad<VectorType, BufferType>(check_cfg, pref + "2_e", v2))); TEST_DO(checkMem(*v, supportsEnumerated ? *emv2 : *mv2)); saveMemDuringCompaction(*v); @@ -675,11 +678,11 @@ EnumeratedSaveTest::test(BasicType bt, CollectionType ct, MemAttr::SP emv1 = saveBoth(v1); MemAttr::SP emv2 = saveBoth(v2); - AttributePtr v = make(cfg, pref, true); - checkLoad<VectorType, BufferType>(v, pref + "0_ee", v0); - checkLoad<VectorType, BufferType>(v, pref + "1_ee", v1); - checkLoad<VectorType, BufferType>(v, pref + "2_ee", v2); - v.reset(); + Config check_cfg(cfg); + check_cfg.setFastSearch(true); + checkLoad<VectorType, BufferType>(check_cfg, pref + "0_ee", v0); + checkLoad<VectorType, BufferType>(check_cfg, pref + "1_ee", v1); + checkLoad<VectorType, BufferType>(check_cfg, pref + "2_ee", v2); TEST_DO((testReload<VectorType, BufferType>(v0, v1, v2, mv0, mv1, mv2, diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp index 70250b05bf1..56aaf2dcbc9 100644 --- a/searchlib/src/tests/features/prod_features.cpp +++ b/searchlib/src/tests/features/prod_features.cpp @@ -428,6 +428,7 @@ Test::setupForAttributeTest(FtFeatureTest &ft, bool setup_env) // save 'sint' and load it into 'unique' (only way to set a noupdate attribute) ASSERT_TRUE(avs[0]->save(avs[9]->getBaseFileName())); + avs[9] = AttributeFactory::createAttribute("udefint", AVC(AVBT::INT32, AVCT::SINGLE)); ASSERT_TRUE(avs[9]->load()); } diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index 5d76aaf90f8..3e949384d4a 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -436,6 +436,7 @@ AttributeVector::isEnumeratedSaveFormat() const bool AttributeVector::load() { + assert(!_loaded); bool loaded = onLoad(); if (loaded) { commit(); diff --git a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp index e3e6eca93b4..1ffab41df28 100644 --- a/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/fixedsourceselector.cpp @@ -39,8 +39,10 @@ FixedSourceSelector::FixedSourceSelector(queryeval::Source defaultSource, SourceSelector(defaultSource, AttributeVector::SP(new SourceStore(attrBaseFileName, getConfig()))), _source(static_cast<SourceStore &>(*_realSource)) { - reserve(initialNumDocs); - _source.commit(); + if (initialNumDocs != std::numeric_limits<uint32_t>::max()) { + reserve(initialNumDocs); + _source.commit(); + } } FixedSourceSelector::~FixedSourceSelector() @@ -80,7 +82,7 @@ FixedSourceSelector::load(const vespalib::string & baseFileName, uint32_t curren FixedSourceSelector::UP selector(new FixedSourceSelector( defaultSource, info->header()._baseFileName, - 0)); + std::numeric_limits<uint32_t>::max())); selector->setBaseId(info->header()._baseId); selector->_source.load(); uint32_t cappedSources = capSelector(selector->_source, selector->getDefaultSource()); |