diff options
69 files changed, 153 insertions, 154 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index 1853e939d42..2dc804404b2 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -244,7 +244,7 @@ void DocumentMetaStore::onGenerationChange(generation_t generation) { _gidToLidMap.getAllocator().freeze(); - _gidToLidMap.getAllocator().transferHoldLists(generation - 1); + _gidToLidMap.getAllocator().assign_generation(generation - 1); getGenerationHolder().assign_generation(generation - 1); updateStat(false); } @@ -318,7 +318,7 @@ DocumentMetaStore::onLoad(vespalib::Executor *) _gidToLidMap.assign(treeBuilder); _gidToLidMap.getAllocator().freeze(); // create initial frozen tree generation_t generation = getGenerationHandler().getCurrentGeneration(); - _gidToLidMap.getAllocator().transferHoldLists(generation); + _gidToLidMap.getAllocator().assign_generation(generation); setNumDocs(_metaDataStore.size()); setCommittedDocIdLimit(_metaDataStore.size()); @@ -433,7 +433,7 @@ DocumentMetaStore::DocumentMetaStore(BucketDBOwnerSP bucketDB, setCommittedDocIdLimit(1u); // lid 0 is reserved _gidToLidMap.getAllocator().freeze(); // create initial frozen tree generation_t generation = getGenerationHandler().getCurrentGeneration(); - _gidToLidMap.getAllocator().transferHoldLists(generation); + _gidToLidMap.getAllocator().assign_generation(generation); updateStat(true); } diff --git a/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp b/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp index 0635b86121a..fded2295ef6 100644 --- a/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp +++ b/searchlib/src/tests/attribute/document_weight_or_filter_search/document_weight_or_filter_search_test.cpp @@ -143,7 +143,7 @@ void DocumentWeightOrFilterSearchTest::inc_generation() { _postings.freeze(); - _postings.transferHoldLists(_gens.getCurrentGeneration()); + _postings.assign_generation(_gens.getCurrentGeneration()); _gens.incGeneration(); _gens.update_oldest_used_generation(); _postings.trimHoldLists(_gens.get_oldest_used_generation()); diff --git a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp index b957c31c7dc..64730871d9d 100644 --- a/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp +++ b/searchlib/src/tests/attribute/enum_comparator/enum_comparator_test.cpp @@ -147,7 +147,7 @@ TEST("requireThatComparatorWithTreeIsWorking") EXPECT_EQUAL(101, exp); t.clear(m); m.freeze(); - m.transferHoldLists(g.getCurrentGeneration()); + m.assign_generation(g.getCurrentGeneration()); g.incGeneration(); m.trimHoldLists(g.get_oldest_used_generation()); } diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index 02ff01043b0..8a9e053a612 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -345,7 +345,7 @@ TEST(EnumStoreTest, test_hold_lists_and_generation) // check readers again checkReaders(ses, readers); - ses.transfer_hold_lists(sesGen); + ses.assign_generation(sesGen); ses.trim_hold_lists(sesGen + 1); } @@ -357,7 +357,7 @@ dec_ref_count(NumericEnumStore& store, NumericEnumStore::Index idx) updater.commit(); generation_t gen = 5; - store.transfer_hold_lists(gen); + store.assign_generation(gen); store.trim_hold_lists(gen + 1); } @@ -882,7 +882,7 @@ namespace { void inc_generation(generation_t &gen, NumericEnumStore &store) { store.freeze_dictionary(); - store.transfer_hold_lists(gen); + store.assign_generation(gen); ++gen; store.trim_hold_lists(gen); } 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 735ebcff6cf..19dd94c5f3c 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 @@ -45,7 +45,7 @@ class MyAttribute : public search::NotImplementedAttribute _mvMapping.trimHoldLists(firstUsed); } virtual void onGenerationChange(generation_t generation) override { - _mvMapping.transferHoldLists(generation - 1); + _mvMapping.assign_generation(generation - 1); } public: @@ -115,7 +115,7 @@ public: ConstArrayRef act = get(docId); EXPECT_EQ(exp, std::vector<EntryT>(act.cbegin(), act.cend())); } - void transferHoldLists(generation_t generation) { _mvMapping->transferHoldLists(generation); } + void assign_generation(generation_t current_gen) { _mvMapping->assign_generation(current_gen); } void trimHoldLists(generation_t firstUsed) { _mvMapping->trimHoldLists(firstUsed); } void addDocs(uint32_t numDocs) { for (uint32_t i = 0; i < numDocs; ++i) { @@ -245,7 +245,7 @@ TEST_F(IntMappingTest, test_that_old_value_is_not_overwritten_while_held) auto old3 = get(3); assertArray({5}, old3); set(3, {7}); - transferHoldLists(10); + assign_generation(10); assertArray({5}, old3); assertGet(3, {7}); trimHoldLists(10); 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 a2d04488003..5b07c0120bf 100644 --- a/searchlib/src/tests/attribute/posting_store/posting_store_test.cpp +++ b/searchlib/src/tests/attribute/posting_store/posting_store_test.cpp @@ -64,8 +64,8 @@ protected: { _value_store.freeze_dictionary(); _store.freeze(); - _value_store.transfer_hold_lists(_gen_handler.getCurrentGeneration()); - _store.transferHoldLists(_gen_handler.getCurrentGeneration()); + _value_store.assign_generation(_gen_handler.getCurrentGeneration()); + _store.assign_generation(_gen_handler.getCurrentGeneration()); _gen_handler.incGeneration(); _value_store.trim_hold_lists(_gen_handler.get_oldest_used_generation()); _store.trimHoldLists(_gen_handler.get_oldest_used_generation()); diff --git a/searchlib/src/tests/attribute/postinglist/postinglist.cpp b/searchlib/src/tests/attribute/postinglist/postinglist.cpp index 9e3ea72045f..0c0187eb8de 100644 --- a/searchlib/src/tests/attribute/postinglist/postinglist.cpp +++ b/searchlib/src/tests/attribute/postinglist/postinglist.cpp @@ -259,9 +259,9 @@ AttributePostingListTest::freeTree(bool verbose) static_cast<uint64_t>(_intNodeAlloc->getMemoryUsage().allocatedBytesOnHold())); _intNodeAlloc->freeze(); _intPostings->freeze(); - _intNodeAlloc->transferHoldLists(_handler.getCurrentGeneration()); + _intNodeAlloc->assign_generation(_handler.getCurrentGeneration()); _intPostings->clearBuilder(); - _intPostings->transferHoldLists(_handler.getCurrentGeneration()); + _intPostings->assign_generation(_handler.getCurrentGeneration()); _handler.incGeneration(); _intNodeAlloc->trimHoldLists(_handler.get_oldest_used_generation()); _intPostings->trimHoldLists(_handler.get_oldest_used_generation()); @@ -613,7 +613,7 @@ AttributePostingListTest::doCompactEnumStore(Tree &tree, valueHandle.holdBuffer(*it); } generation_t generation = _handler.getCurrentGeneration(); - valueHandle.transferHoldLists(generation); + valueHandle.assign_generation(generation); _handler.incGeneration(); valueHandle.trimHoldLists(_handler.get_oldest_used_generation()); @@ -658,8 +658,8 @@ bumpGeneration(Tree &tree, (void) tree; (void) valueHandle; postingsAlloc.freeze(); - postingsAlloc.transferHoldLists(_handler.getCurrentGeneration()); - postings.transferHoldLists(_handler.getCurrentGeneration()); + postingsAlloc.assign_generation(_handler.getCurrentGeneration()); + postings.assign_generation(_handler.getCurrentGeneration()); _handler.incGeneration(); } @@ -689,7 +689,7 @@ AttributePostingListTest::Main() lookupRandomValues(*_intTree, *_intNodeAlloc, *_intKeyStore, *_intPostings, _stlTree, _randomValues); _intNodeAlloc->freeze(); - _intNodeAlloc->transferHoldLists(_handler.getCurrentGeneration()); + _intNodeAlloc->assign_generation(_handler.getCurrentGeneration()); doCompactEnumStore(*_intTree, *_intNodeAlloc, *_intKeyStore); removeRandomValues(*_intTree, *_intNodeAlloc, *_intKeyStore, *_intPostings, _stlTree, _randomValues); diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp index 222a3341ef9..5c6d9d42cf2 100644 --- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp +++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp @@ -221,7 +221,7 @@ public: auto vector = _vectors.get_vector(docid).typify<double>(); _removes.emplace_back(docid, DoubleVector(vector.begin(), vector.end())); } - void transfer_hold_lists(generation_t current_gen) override { + void assign_generation(generation_t current_gen) override { _transfer_gen = current_gen; } void trim_hold_lists(generation_t first_used_gen) override { diff --git a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp index 1ebef22bab7..9526b65846d 100644 --- a/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp +++ b/searchlib/src/tests/tensor/hnsw_index/hnsw_index_test.cpp @@ -99,7 +99,7 @@ public: commit(); } void commit() { - index->transfer_hold_lists(gen_handler.getCurrentGeneration()); + index->assign_generation(gen_handler.getCurrentGeneration()); gen_handler.incGeneration(); gen_handler.update_oldest_used_generation(); index->trim_hold_lists(gen_handler.get_oldest_used_generation()); diff --git a/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp b/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp index 69a454e92cb..428e6654039 100644 --- a/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp +++ b/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp @@ -267,7 +267,7 @@ public: ASSERT_EQ(r.get(), nullptr); } void commit(uint32_t docid) { - index->transfer_hold_lists(gen_handler.getCurrentGeneration()); + index->assign_generation(gen_handler.getCurrentGeneration()); gen_handler.incGeneration(); gen_handler.update_oldest_used_generation(); index->trim_hold_lists(gen_handler.get_oldest_used_generation()); diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.h b/searchlib/src/vespa/searchlib/attribute/enumstore.h index 52f42ed368e..53044fa5511 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.h @@ -96,7 +96,7 @@ public: vespalib::AddressSpace get_values_address_space_usage() const override; - void transfer_hold_lists(generation_t generation); + void assign_generation(generation_t current_gen); void trim_hold_lists(generation_t first_used); ssize_t load_unique_values(const void* src, size_t available, IndexVector& idx) override; diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp index 1ef194f6812..ef87c55f4cc 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp @@ -104,9 +104,9 @@ EnumStoreT<EntryT>::get_values_address_space_usage() const template <typename EntryT> void -EnumStoreT<EntryT>::transfer_hold_lists(generation_t generation) +EnumStoreT<EntryT>::assign_generation(generation_t current_gen) { - _store.transferHoldLists(generation); + _store.assign_generation(current_gen); } template <typename EntryT> diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h index 61798959f3e..2468a58211c 100644 --- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h +++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.h @@ -48,7 +48,7 @@ public: */ ReadView make_read_view(size_t read_size) const { return ReadView(_indices.make_read_view(read_size), &_store); } // Pass on hold list management to underlying store - void transferHoldLists(generation_t generation) { _store.transferHoldLists(generation); } + void assign_generation(generation_t current_gen) { _store.assign_generation(current_gen); } void trimHoldLists(generation_t firstUsed) { _store.trimHoldLists(firstUsed); } void prepareLoadFromMultiValue() { _store.setInitializing(true); } diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp index ec948882312..6b0f4290d69 100644 --- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.hpp @@ -211,8 +211,8 @@ MultiValueEnumAttribute<B, M>::onGenerationChange(generation_t generation) * sufficiently new frozen tree. */ freezeEnumDictionary(); - this->_mvMapping.transferHoldLists(generation - 1); - this->_enumStore.transfer_hold_lists(generation - 1); + this->_mvMapping.assign_generation(generation - 1); + this->_enumStore.assign_generation(generation - 1); } template <typename B, typename M> diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp index 8cabd8483bf..c98a236e6d7 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.hpp @@ -105,7 +105,7 @@ void MultiValueNumericAttribute<B, M>::removeOldGenerations(generation_t firstUs template <typename B, typename M> void MultiValueNumericAttribute<B, M>::onGenerationChange(generation_t generation) { - this->_mvMapping.transferHoldLists(generation - 1); + this->_mvMapping.assign_generation(generation - 1); } template <typename B, typename M> diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp index 9a8c9738bc0..41dbc0aff40 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp @@ -68,7 +68,7 @@ MultiValueNumericPostingAttribute<B, M>::onGenerationChange(generation_t generat { _postingList.freeze(); MultiValueNumericEnumAttribute<B, M>::onGenerationChange(generation); - _postingList.transferHoldLists(generation - 1); + _postingList.assign_generation(generation - 1); } template <typename B, typename M> diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp index fef3db582c8..252e71d0dde 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp @@ -87,7 +87,7 @@ MultiValueStringPostingAttributeT<B, T>::onGenerationChange(generation_t generat { _postingList.freeze(); MultiValueStringAttributeT<B, T>::onGenerationChange(generation); - _postingList.transferHoldLists(generation - 1); + _postingList.assign_generation(generation - 1); } diff --git a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp index f2e07bba853..ff27adeb24a 100644 --- a/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/predicate_attribute.cpp @@ -135,7 +135,7 @@ void PredicateAttribute::onGenerationChange(generation_t generation) { getGenerationHolder().assign_generation(generation - 1); - _index->transferHoldLists(generation - 1); + _index->assign_generation(generation - 1); } void diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp index 36fb02f4c4b..ca25e2068a2 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp @@ -173,8 +173,8 @@ ReferenceAttribute::onGenerationChange(generation_t generation) { _referenceMappings.freeze(); _store.freeze(); - _referenceMappings.transferHoldLists(generation - 1); - _store.transferHoldLists(generation - 1); + _referenceMappings.assign_generation(generation - 1); + _store.assign_generation(generation - 1); getGenerationHolder().assign_generation(generation - 1); } diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h index 2ccc164bf08..50f6b9188f3 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h +++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h @@ -61,7 +61,7 @@ public: // Hold list management & freezing void trimHoldLists(generation_t usedGen) { _reverseMapping.trimHoldLists(usedGen); } void freeze() { _reverseMapping.freeze(); } - void transferHoldLists(generation_t generation) { _reverseMapping.transferHoldLists(generation); } + void assign_generation(generation_t current_gen) { _reverseMapping.assign_generation(current_gen); } // Handle mapping changes void notifyReferencedPut(const Reference &entry, uint32_t targetLid); diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp index 11742bf8f48..0086b1b3455 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp @@ -282,7 +282,7 @@ SingleValueEnumAttribute<B>::onGenerationChange(generation_t generation) */ freezeEnumDictionary(); getGenerationHolder().assign_generation(generation - 1); - this->_enumStore.transfer_hold_lists(generation - 1); + this->_enumStore.assign_generation(generation - 1); } diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp index 2050f887c33..dfd66bbbf04 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp @@ -139,7 +139,7 @@ SingleValueNumericPostingAttribute<B>::onGenerationChange(generation_t generatio { _postingList.freeze(); SingleValueNumericEnumAttribute<B>::onGenerationChange(generation); - _postingList.transferHoldLists(generation - 1); + _postingList.assign_generation(generation - 1); } template <typename B> diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp index f340d9f70c3..3bb26b61ba9 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.hpp @@ -139,7 +139,7 @@ SingleValueStringPostingAttributeT<B>::onGenerationChange(generation_t generatio { _postingList.freeze(); SingleValueStringAttributeT<B>::onGenerationChange(generation); - _postingList.transferHoldLists(generation - 1); + _postingList.assign_generation(generation - 1); } template <typename B> diff --git a/searchlib/src/vespa/searchlib/memoryindex/feature_store.h b/searchlib/src/vespa/searchlib/memoryindex/feature_store.h index adeeba4d06e..db917423bf9 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/feature_store.h +++ b/searchlib/src/vespa/searchlib/memoryindex/feature_store.h @@ -206,7 +206,7 @@ public: const std::vector<PosOccFieldsParams> &getFieldsParams() const { return _fieldsParams; } void trimHoldLists(generation_t usedGen) { _store.trimHoldLists(usedGen); } - void transferHoldLists(generation_t generation) { _store.transferHoldLists(generation); } + void assign_generation(generation_t current_gen) { _store.assign_generation(current_gen); } void clearHoldLists() { _store.clearHoldLists();} std::unique_ptr<vespalib::datastore::CompactingBuffers> start_compact(); vespalib::MemoryUsage getMemoryUsage() const { return _store.getMemoryUsage(); } diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp index da95f2598b7..7e6c53e627c 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.cpp @@ -69,10 +69,10 @@ FieldIndex<interleaved_features>::~FieldIndex() } _postingListStore.clearBuilder(); freeze(); // Flush all pending posting list tree freezes - transferHoldLists(); + assign_generation(); _dict.clear(); // Clear dictionary freeze(); // Flush pending freeze for dictionary tree. - transferHoldLists(); + assign_generation(); incGeneration(); trimHoldLists(); } @@ -143,7 +143,7 @@ FieldIndex<interleaved_features>::compactFeatures() using generation_t = GenerationHandler::generation_t; compacting_buffers->finish(); generation_t generation = _generationHandler.getCurrentGeneration(); - _featureStore.transferHoldLists(generation); + _featureStore.assign_generation(generation); } template <bool interleaved_features> diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index.h b/searchlib/src/vespa/searchlib/memoryindex/field_index.h index bd087c8eae1..0efb3cbe13f 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/field_index.h +++ b/searchlib/src/vespa/searchlib/memoryindex/field_index.h @@ -60,12 +60,12 @@ private: _featureStore.trimHoldLists(usedGen); } - void transferHoldLists() { + void assign_generation() { GenerationHandler::generation_t generation = _generationHandler.getCurrentGeneration(); - _postingListStore.transferHoldLists(generation); - _dict.getAllocator().transferHoldLists(generation); - _featureStore.transferHoldLists(generation); + _postingListStore.assign_generation(generation); + _dict.getAllocator().assign_generation(generation); + _featureStore.assign_generation(generation); } void incGeneration() { @@ -90,7 +90,7 @@ public: void commit() override { _remover.flush(); freeze(); - transferHoldLists(); + assign_generation(); incGeneration(); trimHoldLists(); } diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp index c64c490039b..36312950867 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp @@ -221,11 +221,11 @@ PredicateIndex::trimHoldLists(generation_t used_generation) { } void -PredicateIndex::transferHoldLists(generation_t generation) { - _interval_index.transferHoldLists(generation); - _bounds_index.transferHoldLists(generation); - _interval_store.transferHoldLists(generation); - _zero_constraint_docs.getAllocator().transferHoldLists(generation); +PredicateIndex::assign_generation(generation_t current_gen) { + _interval_index.assign_generation(current_gen); + _bounds_index.assign_generation(current_gen); + _interval_store.assign_generation(current_gen); + _zero_constraint_docs.getAllocator().assign_generation(current_gen); } vespalib::MemoryUsage diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.h b/searchlib/src/vespa/searchlib/predicate/predicate_index.h index 1bad95c6aa9..b6e67961cdc 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.h @@ -74,7 +74,7 @@ public: void removeDocument(uint32_t doc_id); void commit(); void trimHoldLists(generation_t used_generation); - void transferHoldLists(generation_t generation); + void assign_generation(generation_t current_gen); vespalib::MemoryUsage getMemoryUsage() const; int getArity() const { return _arity; } diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp index 379c859f6c3..4def6cf0725 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.cpp @@ -105,8 +105,8 @@ PredicateIntervalStore::trimHoldLists(generation_t used_generation) { } void -PredicateIntervalStore::transferHoldLists(generation_t generation) { - _store.transferHoldLists(generation); +PredicateIntervalStore::assign_generation(generation_t current_gen) { + _store.assign_generation(current_gen); } } diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h index 0b3e32ec6b7..af14755292e 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_interval_store.h @@ -73,7 +73,7 @@ public: void trimHoldLists(generation_t used_generation); - void transferHoldLists(generation_t generation); + void assign_generation(generation_t current_gen); /** * Return memory usage (only the data store is included) diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.h b/searchlib/src/vespa/searchlib/predicate/simple_index.h index 78805820a30..be5229c35aa 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.h +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.h @@ -188,7 +188,7 @@ public: void promoteOverThresholdVectors(); void commit(); void trimHoldLists(generation_t used_generation); - void transferHoldLists(generation_t generation); + void assign_generation(generation_t current_gen); vespalib::MemoryUsage getMemoryUsage() const; template <typename FunctionType> void foreach_frozen_key(vespalib::datastore::EntryRef ref, Key key, FunctionType func) const; diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp index cb37fec26ea..7b4cfa1c55d 100644 --- a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp +++ b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp @@ -300,10 +300,10 @@ SimpleIndex<Posting, Key, DocId>::trimHoldLists(generation_t used_generation) { template <typename Posting, typename Key, typename DocId> void -SimpleIndex<Posting, Key, DocId>::transferHoldLists(generation_t generation) { - _dictionary.getAllocator().transferHoldLists(generation); - _btree_posting_lists.transferHoldLists(generation); - _vector_posting_lists.getAllocator().transferHoldLists(generation); +SimpleIndex<Posting, Key, DocId>::assign_generation(generation_t current_gen) { + _dictionary.getAllocator().assign_generation(current_gen); + _btree_posting_lists.assign_generation(current_gen); + _vector_posting_lists.getAllocator().assign_generation(current_gen); } template <typename Posting, typename Key, typename DocId> diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp index 0c797fa7fe1..11366952ad2 100644 --- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp @@ -456,7 +456,7 @@ DenseTensorAttribute::onGenerationChange(generation_t next_gen) // This applies for entire attribute vector code. TensorAttribute::onGenerationChange(next_gen); if (_index) { - _index->transfer_hold_lists(next_gen - 1); + _index->assign_generation(next_gen - 1); } } diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp index d23bbcfbed4..4afdbf12ae5 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp @@ -511,13 +511,13 @@ HnswIndex::remove_document(uint32_t docid) } void -HnswIndex::transfer_hold_lists(generation_t current_gen) +HnswIndex::assign_generation(generation_t current_gen) { // Note: RcuVector transfers hold lists as part of reallocation based on current generation. // We need to set the next generation here, as it is incremented on a higher level right after this call. _graph.node_refs.setGeneration(current_gen + 1); - _graph.nodes.transferHoldLists(current_gen); - _graph.links.transferHoldLists(current_gen); + _graph.nodes.assign_generation(current_gen); + _graph.links.assign_generation(current_gen); } void diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h index e3ffada1fc2..04abb197cb9 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h @@ -187,7 +187,7 @@ public: vespalib::GenerationHandler::Guard read_guard) const override; void complete_add_document(uint32_t docid, std::unique_ptr<PrepareResult> prepare_result) override; void remove_document(uint32_t docid) override; - void transfer_hold_lists(generation_t current_gen) override; + void assign_generation(generation_t current_gen) override; void trim_hold_lists(generation_t first_used_gen) override; void compact_level_arrays(CompactionSpec compaction_spec, const CompactionStrategy& compaction_strategy); void compact_link_arrays(CompactionSpec compaction_spec, const CompactionStrategy& compaction_strategy); diff --git a/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h b/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h index 51d66fdd14d..74e0c3e0d18 100644 --- a/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h +++ b/searchlib/src/vespa/searchlib/tensor/nearest_neighbor_index.h @@ -68,7 +68,7 @@ public: virtual void complete_add_document(uint32_t docid, std::unique_ptr<PrepareResult> prepare_result) = 0; virtual void remove_document(uint32_t docid) = 0; - virtual void transfer_hold_lists(generation_t current_gen) = 0; + virtual void assign_generation(generation_t current_gen) = 0; virtual void trim_hold_lists(generation_t first_used_gen) = 0; virtual bool consider_compact(const CompactionStrategy& compaction_strategy) = 0; virtual vespalib::MemoryUsage update_stat(const CompactionStrategy& compaction_strategy) = 0; diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp index b233960e339..cb1668dae3c 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp @@ -120,7 +120,7 @@ void TensorAttribute::onGenerationChange(generation_t generation) { getGenerationHolder().assign_generation(generation - 1); - _tensorStore.transferHoldLists(generation - 1); + _tensorStore.assign_generation(generation - 1); } bool diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_store.h b/searchlib/src/vespa/searchlib/tensor/tensor_store.h index e2426d2e899..9ff6b7ffddd 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_store.h +++ b/searchlib/src/vespa/searchlib/tensor/tensor_store.h @@ -53,8 +53,8 @@ public: } // Inherit doc from DataStoreBase - void transferHoldLists(generation_t generation) { - _store.transferHoldLists(generation); + void assign_generation(generation_t current_gen) { + _store.assign_generation(current_gen); } void clearHoldLists() { diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp index e13d746df49..a57cd36b3b1 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.cpp @@ -169,9 +169,9 @@ FakeMemTreeOccMgr::freeze() void -FakeMemTreeOccMgr::transferHoldLists() +FakeMemTreeOccMgr::assign_generation() { - _allocator.transferHoldLists(_generationHandler.getCurrentGeneration()); + _allocator.assign_generation(_generationHandler.getCurrentGeneration()); } void @@ -192,7 +192,7 @@ void FakeMemTreeOccMgr::sync() { freeze(); - transferHoldLists(); + assign_generation(); incGeneration(); trimHoldLists(); } diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h index d0a75930ed5..4081070d8f8 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h @@ -94,7 +94,7 @@ public: ~FakeMemTreeOccMgr(); void freeze(); - void transferHoldLists(); + void assign_generation(); void incGeneration(); void trimHoldLists(); void sync(); diff --git a/storage/src/vespa/storage/bucketdb/generic_btree_bucket_database.hpp b/storage/src/vespa/storage/bucketdb/generic_btree_bucket_database.hpp index f3a16f5826e..3e4a2f28042 100644 --- a/storage/src/vespa/storage/bucketdb/generic_btree_bucket_database.hpp +++ b/storage/src/vespa/storage/bucketdb/generic_btree_bucket_database.hpp @@ -38,8 +38,8 @@ void GenericBTreeBucketDatabase<DataStoreTraitsT>::commit_tree_changes() { _tree.getAllocator().freeze(); auto current_gen = _generation_handler.getCurrentGeneration(); - _store.transferHoldLists(current_gen); - _tree.getAllocator().transferHoldLists(current_gen); + _store.assign_generation(current_gen); + _tree.getAllocator().assign_generation(current_gen); _generation_handler.incGeneration(); diff --git a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp index 2c9455701f7..03bc09211b4 100644 --- a/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp +++ b/vespalib/src/tests/btree/btree-stress/btree_stress_test.cpp @@ -59,7 +59,7 @@ public: AtomicEntryRef add_relaxed(uint32_t value) { return AtomicEntryRef(add(value)); } void hold(const AtomicEntryRef& ref) { _store.holdElem(ref.load_relaxed(), 1); } EntryRef move(EntryRef ref); - void transfer_hold_lists(generation_t gen) { _store.transferHoldLists(gen); } + void assign_generation(generation_t current_gen) { _store.assign_generation(current_gen); } void trim_hold_lists(generation_t gen) { _store.trimHoldLists(gen); } uint32_t get(EntryRef ref) const { return _store.getEntry(ref); } uint32_t get_acquire(const AtomicEntryRef& ref) const { return get(ref.load_acquire()); } @@ -118,7 +118,7 @@ public: static uint32_t add(uint32_t value) noexcept { return value; } static uint32_t add_relaxed(uint32_t value) noexcept { return value; } static void hold(uint32_t) noexcept { } - static void transfer_hold_lists(generation_t) noexcept { } + static void assign_generation(generation_t) noexcept { } static void trim_hold_lists(generation_t) noexcept { } static uint32_t get(uint32_t value) noexcept { return value; } static uint32_t get_acquire(uint32_t value) noexcept { return value; } @@ -274,10 +274,10 @@ Fixture<Params>::commit() auto &allocator = _tree.getAllocator(); allocator.freeze(); auto current_gen = _generationHandler.getCurrentGeneration(); - allocator.transferHoldLists(current_gen); - _keys.transfer_hold_lists(current_gen); - _values.transfer_hold_lists(current_gen); - allocator.transferHoldLists(_generationHandler.getCurrentGeneration()); + allocator.assign_generation(current_gen); + _keys.assign_generation(current_gen); + _values.assign_generation(current_gen); + allocator.assign_generation(_generationHandler.getCurrentGeneration()); _generationHandler.incGeneration(); auto first_used_gen = _generationHandler.get_oldest_used_generation(); allocator.trimHoldLists(first_used_gen); diff --git a/vespalib/src/tests/btree/btree_store/btree_store_test.cpp b/vespalib/src/tests/btree/btree_store/btree_store_test.cpp index 5196d08aa1b..3dcc4830678 100644 --- a/vespalib/src/tests/btree/btree_store/btree_store_test.cpp +++ b/vespalib/src/tests/btree/btree_store/btree_store_test.cpp @@ -31,7 +31,7 @@ protected: void inc_generation() { _store.freeze(); - _store.transferHoldLists(_gen_handler.getCurrentGeneration()); + _store.assign_generation(_gen_handler.getCurrentGeneration()); _gen_handler.incGeneration(); _store.trimHoldLists(_gen_handler.get_oldest_used_generation()); } diff --git a/vespalib/src/tests/btree/btree_test.cpp b/vespalib/src/tests/btree/btree_test.cpp index 8aeef40c957..09877e00ac5 100644 --- a/vespalib/src/tests/btree/btree_test.cpp +++ b/vespalib/src/tests/btree/btree_test.cpp @@ -163,7 +163,7 @@ void cleanup(GenerationHandler & g, ManagerType & m) { m.freeze(); - m.transferHoldLists(g.getCurrentGeneration()); + m.assign_generation(g.getCurrentGeneration()); g.incGeneration(); m.trimHoldLists(g.get_oldest_used_generation()); } @@ -874,7 +874,7 @@ TEST_F(BTreeTest, require_that_we_can_insert_and_remove_from_tree) } compacting_buffers->finish(); manager.freeze(); - manager.transferHoldLists(g.getCurrentGeneration()); + manager.assign_generation(g.getCurrentGeneration()); g.incGeneration(); manager.trimHoldLists(g.get_oldest_used_generation()); } @@ -1106,7 +1106,7 @@ TEST_F(BTreeTest, require_that_memory_usage_is_calculated) EXPECT_TRUE(assertMemoryUsage(mu, tm.getMemoryUsage())); // trim hold lists - tm.transferHoldLists(gh.getCurrentGeneration()); + tm.assign_generation(gh.getCurrentGeneration()); gh.incGeneration(); tm.trimHoldLists(gh.get_oldest_used_generation()); mu = vespalib::MemoryUsage(); @@ -1282,7 +1282,7 @@ TEST_F(BTreeTest, require_that_small_nodes_works) s.clear(root); s.clearBuilder(); s.freeze(); - s.transferHoldLists(g.getCurrentGeneration()); + s.assign_generation(g.getCurrentGeneration()); g.incGeneration(); s.trimHoldLists(g.get_oldest_used_generation()); } @@ -1416,7 +1416,7 @@ TEST_F(BTreeTest, require_that_apply_works) s.clear(root); s.clearBuilder(); s.freeze(); - s.transferHoldLists(g.getCurrentGeneration()); + s.assign_generation(g.getCurrentGeneration()); g.incGeneration(); s.trimHoldLists(g.get_oldest_used_generation()); } @@ -1553,7 +1553,7 @@ inc_generation(GenerationHandler &g, Tree &t) { auto &s = t.getAllocator(); s.freeze(); - s.transferHoldLists(g.getCurrentGeneration()); + s.assign_generation(g.getCurrentGeneration()); g.incGeneration(); s.trimHoldLists(g.get_oldest_used_generation()); } diff --git a/vespalib/src/tests/btree/btreeaggregation_test.cpp b/vespalib/src/tests/btree/btreeaggregation_test.cpp index fbe8e4c8424..6bbf9c13790 100644 --- a/vespalib/src/tests/btree/btreeaggregation_test.cpp +++ b/vespalib/src/tests/btree/btreeaggregation_test.cpp @@ -272,7 +272,7 @@ void freezeTree(GenerationHandler &g, ManagerType &m) { m.freeze(); - m.transferHoldLists(g.getCurrentGeneration()); + m.assign_generation(g.getCurrentGeneration()); g.incGeneration(); m.trimHoldLists(g.get_oldest_used_generation()); } @@ -891,7 +891,7 @@ Test::requireThatWeCanInsertAndRemoveFromTree() } compacting_buffers->finish(); manager.freeze(); - manager.transferHoldLists(g.getCurrentGeneration()); + manager.assign_generation(g.getCurrentGeneration()); g.incGeneration(); manager.trimHoldLists(g.get_oldest_used_generation()); } @@ -1190,7 +1190,7 @@ Test::requireThatSmallNodesWorks() s.clear(root); s.clearBuilder(); s.freeze(); - s.transferHoldLists(g.getCurrentGeneration()); + s.assign_generation(g.getCurrentGeneration()); g.incGeneration(); s.trimHoldLists(g.get_oldest_used_generation()); } diff --git a/vespalib/src/tests/btree/frozenbtree_test.cpp b/vespalib/src/tests/btree/frozenbtree_test.cpp index e031b759f62..55b260fb1d9 100644 --- a/vespalib/src/tests/btree/frozenbtree_test.cpp +++ b/vespalib/src/tests/btree/frozenbtree_test.cpp @@ -134,7 +134,7 @@ FrozenBTreeTest::freeTree(bool verbose) (void) verbose; _tree->clear(*_allocator); _allocator->freeze(); - _allocator->transferHoldLists(_generationHandler->getCurrentGeneration()); + _allocator->assign_generation(_generationHandler->getCurrentGeneration()); _generationHandler->incGeneration(); _allocator->trimHoldLists(_generationHandler->get_oldest_used_generation()); delete _tree; @@ -425,7 +425,7 @@ FrozenBTreeTest::Main() EXPECT_TRUE(_tree->getFrozenView(*_allocator).empty()); _allocator->freeze(); EXPECT_FALSE(_tree->getFrozenView(*_allocator).empty()); - _allocator->transferHoldLists(_generationHandler->getCurrentGeneration()); + _allocator->assign_generation(_generationHandler->getCurrentGeneration()); lookupFrozenRandomValues(*_tree, *_allocator, _randomValues); traverseTreeIterator(*_tree, *_allocator, diff --git a/vespalib/src/tests/datastore/array_store/array_store_test.cpp b/vespalib/src/tests/datastore/array_store/array_store_test.cpp index 1708b0fd948..01c97bc98ab 100644 --- a/vespalib/src/tests/datastore/array_store/array_store_test.cpp +++ b/vespalib/src/tests/datastore/array_store/array_store_test.cpp @@ -137,7 +137,7 @@ struct ArrayStoreTest : public TestT return EntryRef(); } void trimHoldLists() { - store.transferHoldLists(generation++); + store.assign_generation(generation++); store.trimHoldLists(generation); } void compactWorst(bool compactMemory, bool compactAddressSpace) { diff --git a/vespalib/src/tests/datastore/datastore/datastore_test.cpp b/vespalib/src/tests/datastore/datastore/datastore_test.cpp index 1cb4f3e2307..cd1f869ab64 100644 --- a/vespalib/src/tests/datastore/datastore/datastore_test.cpp +++ b/vespalib/src/tests/datastore/datastore/datastore_test.cpp @@ -28,8 +28,8 @@ public: void holdElem(EntryRef ref, uint64_t len) { ParentType::holdElem(ref, len); } - void transferHoldLists(generation_t generation) { - ParentType::transferHoldLists(generation); + void assign_generation(generation_t current_gen) { + ParentType::assign_generation(current_gen); } void reclaim_entry_refs(generation_t oldest_used_gen) override { ParentType::reclaim_entry_refs(oldest_used_gen); @@ -261,23 +261,23 @@ TEST(DataStoreTest, require_that_we_can_hold_and_trim_buffers) s.switch_primary_buffer(); EXPECT_EQ(1u, s.primary_buffer_id()); s.holdBuffer(0); // hold last buffer - s.transferHoldLists(10); + s.assign_generation(10); EXPECT_EQ(1u, MyRef(s.addEntry(2)).bufferId()); s.switch_primary_buffer(); EXPECT_EQ(2u, s.primary_buffer_id()); s.holdBuffer(1); // hold last buffer - s.transferHoldLists(20); + s.assign_generation(20); EXPECT_EQ(2u, MyRef(s.addEntry(3)).bufferId()); s.switch_primary_buffer(); EXPECT_EQ(3u, s.primary_buffer_id()); s.holdBuffer(2); // hold last buffer - s.transferHoldLists(30); + s.assign_generation(30); EXPECT_EQ(3u, MyRef(s.addEntry(4)).bufferId()); s.holdBuffer(3); // hold current buffer - s.transferHoldLists(40); + s.assign_generation(40); EXPECT_TRUE(s.getBufferState(0).size() != 0); EXPECT_TRUE(s.getBufferState(1).size() != 0); @@ -304,13 +304,13 @@ TEST(DataStoreTest, require_that_we_can_hold_and_trim_elements) MyStore s; MyRef r1 = s.addEntry(1); s.holdElem(r1, 1); - s.transferHoldLists(10); + s.assign_generation(10); MyRef r2 = s.addEntry(2); s.holdElem(r2, 1); - s.transferHoldLists(20); + s.assign_generation(20); MyRef r3 = s.addEntry(3); s.holdElem(r3, 1); - s.transferHoldLists(30); + s.assign_generation(30); EXPECT_EQ(1, s.getEntry(r1)); EXPECT_EQ(2, s.getEntry(r2)); EXPECT_EQ(3, s.getEntry(r3)); @@ -358,11 +358,11 @@ TEST(DataStoreTest, require_that_we_can_use_free_lists) s.enableFreeLists(); auto r1 = s.addEntry(1); s.holdElem(r1, 1); - s.transferHoldLists(10); + s.assign_generation(10); auto r2 = s.addEntry(2); expect_successive_refs(r1, r2); s.holdElem(r2, 1); - s.transferHoldLists(20); + s.assign_generation(20); s.reclaim_entry_refs(11); auto r3 = s.addEntry(3); // reuse r1 EXPECT_EQ(r1, r3); @@ -393,7 +393,7 @@ TEST(DataStoreTest, require_that_we_can_use_free_lists_with_raw_allocator) expect_successive_handles(h1, h2); s.holdElem(h1.ref, 3); s.holdElem(h2.ref, 3); - s.transferHoldLists(10); + s.assign_generation(10); s.reclaim_entry_refs(11); auto h3 = allocator.alloc(3); // reuse h2.ref from free list @@ -429,7 +429,7 @@ TEST(DataStoreTest, require_that_memory_stats_are_calculated) s.addEntry(20); s.addEntry(30); s.holdBuffer(r.bufferId()); - s.transferHoldLists(100); + s.assign_generation(100); m._usedElems += 2; m._holdElems = m._usedElems; m._deadElems = 0; @@ -479,7 +479,7 @@ TEST(DataStoreTest, require_that_memory_usage_is_calculated) s.addEntry(30); s.addEntry(40); s.holdBuffer(r.bufferId()); - s.transferHoldLists(100); + s.assign_generation(100); vespalib::MemoryUsage m = s.getMemoryUsage(); EXPECT_EQ(MyRef::offsetSize() * sizeof(int), m.allocatedBytes()); EXPECT_EQ(5 * sizeof(int), m.usedBytes()); @@ -513,7 +513,7 @@ TEST(DataStoreTest, require_that_we_can_disable_elemement_hold_list) EXPECT_EQ(4 * sizeof(int), m.usedBytes()); EXPECT_EQ(2 * sizeof(int), m.deadBytes()); EXPECT_EQ(1 * sizeof(int), m.allocatedBytesOnHold()); - s.transferHoldLists(100); + s.assign_generation(100); s.trimHoldLists(101); } @@ -634,7 +634,7 @@ TEST(DataStoreTest, can_set_memory_allocator) s.switch_primary_buffer(); EXPECT_EQ(AllocStats(3, 0), stats); s.holdBuffer(0); - s.transferHoldLists(10); + s.assign_generation(10); EXPECT_EQ(AllocStats(3, 0), stats); s.trimHoldLists(11); EXPECT_EQ(AllocStats(3, 2), stats); @@ -693,7 +693,7 @@ void test_free_element_to_held_buffer(bool direct, bool before_hold_buffer) ASSERT_DEATH({ s.holdElem(ref, 1); }, "isActive\\(\\)"); } } - s.transferHoldLists(100); + s.assign_generation(100); s.trimHoldLists(101); } diff --git a/vespalib/src/tests/datastore/fixed_size_hash_map/fixed_size_hash_map_test.cpp b/vespalib/src/tests/datastore/fixed_size_hash_map/fixed_size_hash_map_test.cpp index 6abfaced867..053cb804f21 100644 --- a/vespalib/src/tests/datastore/fixed_size_hash_map/fixed_size_hash_map_test.cpp +++ b/vespalib/src/tests/datastore/fixed_size_hash_map/fixed_size_hash_map_test.cpp @@ -88,8 +88,8 @@ DataStoreFixedSizeHashTest::~DataStoreFixedSizeHashTest() void DataStoreFixedSizeHashTest::commit() { - _store.transferHoldLists(_generation_handler.getCurrentGeneration()); - _hash_map->transfer_hold_lists(_generation_handler.getCurrentGeneration()); + _store.assign_generation(_generation_handler.getCurrentGeneration()); + _hash_map->assign_generation(_generation_handler.getCurrentGeneration()); _generation_holder.assign_generation(_generation_handler.getCurrentGeneration()); _generation_handler.incGeneration(); _store.trimHoldLists(_generation_handler.get_oldest_used_generation()); diff --git a/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp b/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp index 67357d780bc..d19a45a263e 100644 --- a/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp +++ b/vespalib/src/tests/datastore/sharded_hash_map/sharded_hash_map_test.cpp @@ -168,8 +168,8 @@ DataStoreShardedHashTest::~DataStoreShardedHashTest() void DataStoreShardedHashTest::commit() { - _store.transferHoldLists(_generationHandler.getCurrentGeneration()); - _hash_map.transfer_hold_lists(_generationHandler.getCurrentGeneration()); + _store.assign_generation(_generationHandler.getCurrentGeneration()); + _hash_map.assign_generation(_generationHandler.getCurrentGeneration()); _generationHandler.incGeneration(); _store.trimHoldLists(_generationHandler.get_oldest_used_generation()); _hash_map.trim_hold_lists(_generationHandler.get_oldest_used_generation()); diff --git a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp index 6612ef998c5..ff5b040dbf6 100644 --- a/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp +++ b/vespalib/src/tests/datastore/unique_store/unique_store_test.cpp @@ -114,7 +114,7 @@ struct TestBase : public ::testing::Test { } void trimHoldLists() { store.freeze(); - store.transferHoldLists(generation++); + store.assign_generation(generation++); store.trimHoldLists(generation); } void compactWorst() { diff --git a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp index 5948303c335..1ee9e354285 100644 --- a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp +++ b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp @@ -62,7 +62,7 @@ struct UniqueStoreDictionaryTest : public ::testing::Test { } void inc_generation() { dict.freeze(); - dict.transfer_hold_lists(gen_handler.getCurrentGeneration()); + dict.assign_generation(gen_handler.getCurrentGeneration()); gen_handler.incGeneration(); dict.trim_hold_lists(gen_handler.get_oldest_used_generation()); } diff --git a/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp b/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp index 0b34f587c6d..4835af53b34 100644 --- a/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp +++ b/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp @@ -68,7 +68,7 @@ struct TestBase : public ::testing::Test { EXPECT_EQ(expStats._extra_hold, buffer_state(ref).stats().extra_hold_bytes()); } void trim_hold_lists() { - allocator.get_data_store().transferHoldLists(generation++); + allocator.get_data_store().assign_generation(generation++); allocator.get_data_store().trimHoldLists(generation); } }; diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h index c631ac4041a..6835ca723d4 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h +++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h @@ -109,7 +109,7 @@ public: * older versions of the frozen structure must leave before elements * can be unheld. */ - void transferHoldLists(generation_t generation); + void assign_generation(generation_t current_gen); void clearHoldLists(); diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp index 8976d73379c..30dea7bf28b 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp +++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.hpp @@ -275,9 +275,9 @@ template <typename KeyT, typename DataT, typename AggrT, size_t INTERNAL_SLOTS, size_t LEAF_SLOTS> void BTreeNodeAllocator<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS>:: -transferHoldLists(generation_t generation) +assign_generation(generation_t current_gen) { - _nodeStore.transferHoldLists(generation); + _nodeStore.assign_generation(current_gen); } diff --git a/vespalib/src/vespa/vespalib/btree/btreenodestore.h b/vespalib/src/vespa/vespalib/btree/btreenodestore.h index 20f80e07a6b..28efd3b4efe 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodestore.h +++ b/vespalib/src/vespa/vespalib/btree/btreenodestore.h @@ -162,8 +162,8 @@ public: std::unique_ptr<vespalib::datastore::CompactingBuffers> start_compact_worst(const CompactionStrategy& compaction_strategy); - void transferHoldLists(generation_t generation) { - _store.transferHoldLists(generation); + void assign_generation(generation_t current_gen) { + _store.assign_generation(current_gen); } // Inherit doc from DataStoreBase diff --git a/vespalib/src/vespa/vespalib/btree/btreestore.h b/vespalib/src/vespa/vespalib/btree/btreestore.h index 54bc397175d..66a1c53814d 100644 --- a/vespalib/src/vespa/vespalib/btree/btreestore.h +++ b/vespalib/src/vespa/vespalib/btree/btreestore.h @@ -340,10 +340,10 @@ public: // Inherit doc from DataStoreBase void - transferHoldLists(generation_t generation) + assign_generation(generation_t current_gen) { - _allocator.transferHoldLists(generation); - _store.transferHoldLists(generation); + _allocator.assign_generation(current_gen); + _store.assign_generation(current_gen); } void diff --git a/vespalib/src/vespa/vespalib/datastore/array_store.h b/vespalib/src/vespa/vespalib/datastore/array_store.h index db037ee12fb..d807b02a879 100644 --- a/vespalib/src/vespa/vespalib/datastore/array_store.h +++ b/vespalib/src/vespa/vespalib/datastore/array_store.h @@ -114,7 +114,7 @@ public: vespalib::AddressSpace addressSpaceUsage() const; // Pass on hold list management to underlying store - void transferHoldLists(generation_t generation) { _store.transferHoldLists(generation); } + void assign_generation(generation_t current_gen) { _store.assign_generation(current_gen); } void trimHoldLists(generation_t firstUsed) { _store.trimHoldLists(firstUsed); } vespalib::GenerationHolder &getGenerationHolder() { return _store.getGenerationHolder(); } void setInitializing(bool initializing) { _store.setInitializing(initializing); } diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp index 4589fbba6fa..099410a502b 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp +++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp @@ -220,10 +220,10 @@ DataStoreBase::addType(BufferTypeBase *typeHandler) } void -DataStoreBase::transferHoldLists(generation_t generation) +DataStoreBase::assign_generation(generation_t current_gen) { - _genHolder.assign_generation(generation); - _entry_ref_hold_list.assign_generation(generation); + _genHolder.assign_generation(current_gen); + _entry_ref_hold_list.assign_generation(current_gen); } void diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.h b/vespalib/src/vespa/vespalib/datastore/datastorebase.h index 520c13742b5..d334692baad 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastorebase.h +++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.h @@ -189,9 +189,9 @@ public: public: /** - * Transfer holds from hold1 to hold2 lists, assigning generation. + * Assign generation on data elements on hold lists added since the last time this function was called. */ - void transferHoldLists(generation_t generation); + void assign_generation(generation_t current_gen); private: /** diff --git a/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.cpp b/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.cpp index 402905d7aca..ad3fa7bd235 100644 --- a/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.cpp +++ b/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.cpp @@ -97,14 +97,13 @@ FixedSizeHashMap::add(const ShardedHashComparator & comp, std::function<EntryRef } void -FixedSizeHashMap::transfer_hold_lists_slow(generation_t generation) +FixedSizeHashMap::assign_generation_slow(generation_t current_gen) { auto &hold_2_list = _hold_2_list; for (uint32_t node_idx : _hold_1_list) { - hold_2_list.push_back(std::make_pair(generation, node_idx)); + hold_2_list.push_back(std::make_pair(current_gen, node_idx)); } _hold_1_list.clear(); - } diff --git a/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.h b/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.h index dd56b4951bc..e2f4a2a89a5 100644 --- a/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.h +++ b/vespalib/src/vespa/vespalib/datastore/fixed_size_hash_map.h @@ -56,7 +56,7 @@ private: * A reader must own an appropriate GenerationHandler::Guard to ensure * that memory is held while it can be accessed by reader. * - * The writer must update generation and call transfer_hold_lists and + * The writer must update generation and call assign_generation and * trim_hold_lists as needed to free up memory no longer needed by any * readers. */ @@ -114,7 +114,7 @@ private: std::deque<std::pair<generation_t, uint32_t>> _hold_2_list; uint32_t _num_shards; - void transfer_hold_lists_slow(generation_t generation); + void assign_generation_slow(generation_t current_gen); void trim_hold_lists_slow(generation_t first_used); void force_add(const EntryComparator& comp, const KvType& kv); public: @@ -143,9 +143,9 @@ public: return nullptr; } - void transfer_hold_lists(generation_t generation) { + void assign_generation(generation_t current_gen) { if (!_hold_1_list.empty()) { - transfer_hold_lists_slow(generation); + assign_generation_slow(current_gen); } } diff --git a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h index 48abda45974..533407d2f97 100644 --- a/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h +++ b/vespalib/src/vespa/vespalib/datastore/i_unique_store_dictionary.h @@ -25,7 +25,7 @@ public: using generation_t = vespalib::GenerationHandler::generation_t; virtual ~IUniqueStoreDictionary() = default; virtual void freeze() = 0; - virtual void transfer_hold_lists(generation_t generation) = 0; + virtual void assign_generation(generation_t current_gen) = 0; virtual void trim_hold_lists(generation_t firstUsed) = 0; virtual UniqueStoreAddResult add(const EntryComparator& comp, std::function<EntryRef(void)> insertEntry) = 0; virtual EntryRef find(const EntryComparator& comp) = 0; diff --git a/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.cpp b/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.cpp index 86578f663a1..f72162a6be7 100644 --- a/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.cpp +++ b/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.cpp @@ -107,15 +107,15 @@ ShardedHashMap::find(const EntryComparator& comp, EntryRef key_ref) const } void -ShardedHashMap::transfer_hold_lists(generation_t generation) +ShardedHashMap::assign_generation(generation_t current_gen) { for (size_t i = 0; i < num_shards; ++i) { auto map = _maps[i].load(std::memory_order_relaxed); if (map != nullptr) { - map->transfer_hold_lists(generation); + map->assign_generation(current_gen); } } - _gen_holder.assign_generation(generation); + _gen_holder.assign_generation(current_gen); } void diff --git a/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.h b/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.h index 80d14d187b0..89f24e66e69 100644 --- a/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.h +++ b/vespalib/src/vespa/vespalib/datastore/sharded_hash_map.h @@ -28,7 +28,7 @@ struct ICompactable; * A reader must own an appropriate GenerationHandler::Guard to ensure * that memory is held while it can be accessed by reader. * - * The writer must update generation and call transfer_hold_lists and + * The writer must update generation and call assign_generation and * trim_hold_lists as needed to free up memory no longer needed by any * readers. */ @@ -52,7 +52,7 @@ public: KvType* remove(const EntryComparator& comp, EntryRef key_ref); KvType* find(const EntryComparator& comp, EntryRef key_ref); const KvType* find(const EntryComparator& comp, EntryRef key_ref) const; - void transfer_hold_lists(generation_t generation); + void assign_generation(generation_t current_gen); void trim_hold_lists(generation_t first_used); size_t size() const noexcept; const EntryComparator &get_default_comparator() const noexcept { return *_comp; } diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.h b/vespalib/src/vespa/vespalib/datastore/unique_store.h index e7c374985a7..acbb3de3d17 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store.h @@ -70,7 +70,7 @@ public: inline const DataStoreType& get_data_store() const noexcept { return _allocator.get_data_store(); } // Pass on hold list management to underlying store - void transferHoldLists(generation_t generation); + void assign_generation(generation_t current_gen); void trimHoldLists(generation_t firstUsed); vespalib::GenerationHolder &getGenerationHolder() { return _store.getGenerationHolder(); } void setInitializing(bool initializing) { _store.setInitializing(initializing); } diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp index 63592f82898..8477111dd01 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp @@ -190,10 +190,10 @@ UniqueStore<EntryT, RefT, Compare, Allocator>::bufferState(EntryRef ref) const template <typename EntryT, typename RefT, typename Compare, typename Allocator> void -UniqueStore<EntryT, RefT, Compare, Allocator>::transferHoldLists(generation_t generation) +UniqueStore<EntryT, RefT, Compare, Allocator>::assign_generation(generation_t current_gen) { - _dict->transfer_hold_lists(generation); - _store.transferHoldLists(generation); + _dict->assign_generation(current_gen); + _store.assign_generation(current_gen); } template <typename EntryT, typename RefT, typename Compare, typename Allocator> diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h index 7aed81c3a79..3cbf7b999ff 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.h @@ -74,7 +74,7 @@ public: UniqueStoreDictionary(std::unique_ptr<EntryComparator> compare); ~UniqueStoreDictionary() override; void freeze() override; - void transfer_hold_lists(generation_t generation) override; + void assign_generation(generation_t current_gen) override; void trim_hold_lists(generation_t firstUsed) override; UniqueStoreAddResult add(const EntryComparator& comp, std::function<EntryRef(void)> insertEntry) override; EntryRef find(const EntryComparator& comp) override; diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp index 29c4b6514d7..a3a477f334f 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_dictionary.hpp @@ -41,13 +41,13 @@ UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::freeze() template <typename BTreeDictionaryT, typename ParentT, typename HashDictionaryT> void -UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::transfer_hold_lists(generation_t generation) +UniqueStoreDictionary<BTreeDictionaryT, ParentT, HashDictionaryT>::assign_generation(generation_t current_gen) { if constexpr (has_btree_dictionary) { - this->_btree_dict.getAllocator().transferHoldLists(generation); + this->_btree_dict.getAllocator().assign_generation(current_gen); } if constexpr (has_hash_dictionary) { - this->_hash_dict.transfer_hold_lists(generation); + this->_hash_dict.assign_generation(current_gen); } } |