diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-10-12 17:21:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 17:21:55 +0200 |
commit | 136d2dd0be0515a1cc2c4771081509dc4d080d7d (patch) | |
tree | e8ad6f37a4a41ade82d7d78c8cca9b3b97b84cd7 /searchcore | |
parent | c2fff990ef096c124b235ce34e3975ccccdbe8d6 (diff) | |
parent | 10c830d6c43ca29cb13842ce41dfdc32c8a88969 (diff) |
Merge pull request #24407 from vespa-engine/geirst/generation-hold-list-terminology
Use more general terminology for handling of generation hold lists
Diffstat (limited to 'searchcore')
9 files changed, 22 insertions, 21 deletions
diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp index c52978261a7..7a5c76b201a 100644 --- a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp +++ b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp @@ -56,10 +56,11 @@ hasActiveEnumGuards(AttributeVector &attr) } void -assertGuards(AttributeVector &attr, generation_t expCurrentGeneration, generation_t expFirstUsedGeneration, bool expHasActiveEnumGuards) +assertGuards(AttributeVector &attr, generation_t expCurrentGeneration, generation_t exp_oldest_used_generation, + bool expHasActiveEnumGuards) { EXPECT_EQUAL(expCurrentGeneration, attr.getCurrentGeneration()); - EXPECT_EQUAL(expFirstUsedGeneration, attr.getFirstUsedGeneration()); + EXPECT_EQUAL(exp_oldest_used_generation, attr.get_oldest_used_generation()); EXPECT_EQUAL(expHasActiveEnumGuards, hasActiveEnumGuards(attr)); } diff --git a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp index 157d10e6652..8d8674da4f0 100644 --- a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp @@ -66,8 +66,8 @@ protected: _allocator.holdLids(lids, get_size(), 0); } - void trim_hold_lists() { - _allocator.trimHoldLists(1); + void reclaim_memory() { + _allocator.reclaim_memory(1); } std::vector<uint32_t> get_valid_lids() { @@ -117,7 +117,7 @@ TEST_F(LidAllocatorTest, unregister_lids) assert_valid_lids({2, 4, 6}); assert_active_lids({4, 6}); hold_lids({1, 3, 5}); - trim_hold_lists(); + reclaim_memory(); EXPECT_EQ((std::vector<uint32_t>{1, 3, 5, 7, 8}), alloc_lids(5)); } diff --git a/searchcore/src/tests/proton/documentmetastore/lid_state_vector/lid_state_vector_test.cpp b/searchcore/src/tests/proton/documentmetastore/lid_state_vector/lid_state_vector_test.cpp index 68958bbe3e4..cbc11126b25 100644 --- a/searchcore/src/tests/proton/documentmetastore/lid_state_vector/lid_state_vector_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/lid_state_vector/lid_state_vector_test.cpp @@ -47,7 +47,7 @@ TEST_F(LidStateVectorTest, basic_free_list_is_working) EXPECT_EQ(0u, freeLids.count()); EXPECT_EQ(3u, list.size()); - list.trimHoldLists(20, freeLids); + list.reclaim_memory(20, freeLids); EXPECT_FALSE(freeLids.empty()); EXPECT_EQ(1u, freeLids.count()); @@ -57,7 +57,7 @@ TEST_F(LidStateVectorTest, basic_free_list_is_working) EXPECT_EQ(0u, freeLids.count()); EXPECT_EQ(2u, list.size()); - list.trimHoldLists(31, freeLids); + list.reclaim_memory(31, freeLids); EXPECT_FALSE(freeLids.empty()); EXPECT_EQ(2u, freeLids.count()); diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp index 2f4c26094c7..5152d09fae5 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_mapper/gid_to_lid_mapper_test.cpp @@ -126,11 +126,11 @@ struct Fixture return std::make_shared<GidToLidMapperFactory>(_dmsContext); } - void assertGenerations(generation_t currentGeneration, generation_t firstUsedGeneration) + void assertGenerations(generation_t currentGeneration, generation_t oldest_used_generation) { const GenerationHandler &handler = _dms->getGenerationHandler(); EXPECT_EQUAL(currentGeneration, handler.getCurrentGeneration()); - EXPECT_EQUAL(firstUsedGeneration, handler.getFirstUsedGeneration()); + EXPECT_EQUAL(oldest_used_generation, handler.get_oldest_used_generation()); } template <typename Function> diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp index eeb8cafb859..c153f873480 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp @@ -47,7 +47,7 @@ convertStatusToSlime(const Status &status, Cursor &object) void convertGenerationToSlime(const AttributeVector &attr, Cursor &object) { - object.setLong("firstUsed", attr.getFirstUsedGeneration()); + object.setLong("oldest_used", attr.get_oldest_used_generation()); object.setLong("current", attr.getCurrentGeneration()); } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index 1853e939d42..c6ef6994b81 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); } @@ -252,8 +252,8 @@ DocumentMetaStore::onGenerationChange(generation_t generation) void DocumentMetaStore::removeOldGenerations(generation_t firstUsed) { - _gidToLidMap.getAllocator().trimHoldLists(firstUsed); - _lidAlloc.trimHoldLists(firstUsed); + _gidToLidMap.getAllocator().reclaim_memory(firstUsed); + _lidAlloc.reclaim_memory(firstUsed); getGenerationHolder().reclaim(firstUsed); } @@ -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/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h index 6118701b0dc..95a8cf85279 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h @@ -41,8 +41,8 @@ public: void unregisterLid(DocId lid); void unregister_lids(const std::vector<DocId>& lids); size_t getUsedLidsSize() const { return _usedLids.byteSize(); } - void trimHoldLists(generation_t firstUsed) { - _holdLids.trimHoldLists(firstUsed, _freeLids); + void reclaim_memory(generation_t oldest_used_gen) { + _holdLids.reclaim_memory(oldest_used_gen, _freeLids); } void moveLidBegin(DocId fromLid, DocId toLid); void moveLidEnd(DocId fromLid, DocId toLid); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp index 7157a40c5d5..ef0a244fc37 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp @@ -23,9 +23,9 @@ LidHoldList::clear() { } void -LidHoldList::trimHoldLists(generation_t firstUsed, LidStateVector &freeLids) +LidHoldList::reclaim_memory(generation_t oldest_used_gen, LidStateVector &freeLids) { - while (!_holdList.empty() && _holdList.front().second < firstUsed) { + while (!_holdList.empty() && _holdList.front().second < oldest_used_gen) { uint32_t lid = _holdList.front().first; freeLids.setBit(lid); _holdList.pop_front(); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h index fc32fcb7510..565d8bf25e1 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.h @@ -43,9 +43,9 @@ public: void clear(); /** - * Frees up elements with generation < first used generation for reuse. + * Frees up elements with generation < oldest used generation for reuse. **/ - void trimHoldLists(generation_t firstUsed, LidStateVector &freeLids); + void reclaim_memory(generation_t oldest_used_gen, LidStateVector &freeLids); }; |