Skip to content

Commit

Permalink
Merge pull request #32983 from vespa-engine/toregge/remove-disk-index…
Browse files Browse the repository at this point in the history
…-dictionary-cache

Remove unused disk index dictionary cache.
  • Loading branch information
geirst authored Dec 2, 2024
2 parents f9f654f + b70696e commit 3f540e7
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 242 deletions.
2 changes: 1 addition & 1 deletion configdefinitions/src/vespa/proton.def
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ indexing.threads int default=1 restart

## How much memory is set aside for caching.
## Now only used for caching of dictionary lookups.
## TODO Still relevant, check config model, seems unused.
## DEPRECATED - Not used.
index.cache.size long default=0 restart

## Configure a shared disk index posting list cache across all document dbs.
Expand Down
2 changes: 1 addition & 1 deletion searchcore/src/tests/proton/documentdb/configurer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Fixture::initViewSet(ViewSet &views)
RankingAssetsRepo ranking_assets_repo_source(_constantValueFactory, {}, {}, {});
auto matchers = std::make_shared<Matchers>(_clock.nowRef(), _queryLimiter, ranking_assets_repo_source);
auto indexMgr = make_shared<IndexManager>(BASE_DIR, std::shared_ptr<search::diskindex::IPostingListCache>(),
IndexConfig(searchcorespi::index::WarmupConfig(), 2, 0), Schema(), 1,
IndexConfig(searchcorespi::index::WarmupConfig(), 2), Schema(), 1,
views._reconfigurer, views._service.write(), _summaryExecutor,
TuneFileIndexManager(), TuneFileAttributes(), views._fileHeaderContext);
auto attrMgr = make_shared<AttributeManager>(BASE_DIR, "test.subdb", TuneFileAttributes(),
Expand Down
2 changes: 1 addition & 1 deletion searchcore/src/tests/proton/index/fusionrunner_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ FusionRunnerTest::FusionRunnerTest()
_fusion_spec(),
_fileHeaderContext(),
_service(1),
_ops(_fileHeaderContext,TuneFileIndexManager(), {}, 0, _service.write())
_ops(_fileHeaderContext,TuneFileIndexManager(), {}, _service.write())
{ }

FusionRunnerTest::~FusionRunnerTest() = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ namespace proton {

DiskIndexWrapper::DiskIndexWrapper(const std::string &indexDir,
const TuneFileSearch &tuneFileSearch,
std::shared_ptr<IPostingListCache> posting_list_cache,
size_t dictionary_cache_size)
: _index(indexDir, std::move(posting_list_cache), dictionary_cache_size),
std::shared_ptr<IPostingListCache> posting_list_cache)
: _index(indexDir, std::move(posting_list_cache)),
_serialNum(0)
{
bool setupIndexOk = _index.setup(tuneFileSearch);
Expand All @@ -25,9 +24,8 @@ DiskIndexWrapper::DiskIndexWrapper(const std::string &indexDir,
}

DiskIndexWrapper::DiskIndexWrapper(const DiskIndexWrapper &oldIndex,
const TuneFileSearch &tuneFileSearch,
size_t dictionary_cache_size)
: _index(oldIndex._index.getIndexDir(), oldIndex._index.get_posting_list_cache(), dictionary_cache_size),
const TuneFileSearch &tuneFileSearch)
: _index(oldIndex._index.getIndexDir(), oldIndex._index.get_posting_list_cache()),
_serialNum(0)
{
bool setupIndexOk = _index.setup(tuneFileSearch, oldIndex._index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ class DiskIndexWrapper : public searchcorespi::index::IDiskIndex {
public:
DiskIndexWrapper(const std::string &indexDir,
const search::TuneFileSearch &tuneFileSearch,
std::shared_ptr<search::diskindex::IPostingListCache> posting_list_cache,
size_t dictionary_cache_size);
std::shared_ptr<search::diskindex::IPostingListCache> posting_list_cache);

DiskIndexWrapper(const DiskIndexWrapper &oldIndex,
const search::TuneFileSearch &tuneFileSearch,
size_t dictionary_cache_size);
const search::TuneFileSearch &tuneFileSearch);

std::unique_ptr<search::queryeval::Blueprint>
createBlueprint(const IRequestContext & requestContext, const FieldSpec &field, const Node &term) override {
Expand Down
8 changes: 3 additions & 5 deletions searchcore/src/vespa/searchcore/proton/index/indexmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ namespace proton::index {
IndexManager::MaintainerOperations::MaintainerOperations(const FileHeaderContext &fileHeaderContext,
const TuneFileIndexManager &tuneFileIndexManager,
std::shared_ptr<IPostingListCache> posting_list_cache,
size_t dictionary_cache_size,
IThreadingService &threadingService)
: _posting_list_cache(std::move(posting_list_cache)),
_dictionary_cache_size(dictionary_cache_size),
_fileHeaderContext(fileHeaderContext),
_tuneFileIndexing(tuneFileIndexManager._indexing),
_tuneFileSearch(tuneFileIndexManager._search),
Expand All @@ -54,14 +52,14 @@ IndexManager::MaintainerOperations::createMemoryIndex(const Schema& schema,
IDiskIndex::SP
IndexManager::MaintainerOperations::loadDiskIndex(const std::string &indexDir)
{
return std::make_shared<DiskIndexWrapper>(indexDir, _tuneFileSearch, _posting_list_cache, _dictionary_cache_size);
return std::make_shared<DiskIndexWrapper>(indexDir, _tuneFileSearch, _posting_list_cache);
}

IDiskIndex::SP
IndexManager::MaintainerOperations::reloadDiskIndex(const IDiskIndex &oldIndex)
{
return std::make_shared<DiskIndexWrapper>(dynamic_cast<const DiskIndexWrapper &>(oldIndex),
_tuneFileSearch, _dictionary_cache_size);
_tuneFileSearch);
}

bool
Expand Down Expand Up @@ -90,7 +88,7 @@ IndexManager::IndexManager(const std::string &baseDir,
const search::TuneFileIndexManager &tuneFileIndexManager,
const search::TuneFileAttributes &tuneFileAttributes,
const FileHeaderContext &fileHeaderContext) :
_operations(fileHeaderContext, tuneFileIndexManager, std::move(posting_list_cache), indexConfig.dictionary_cache_size, threadingService),
_operations(fileHeaderContext, tuneFileIndexManager, std::move(posting_list_cache),threadingService),
_maintainer(IndexMaintainerConfig(baseDir, indexConfig.warmup, indexConfig.maxFlushed, schema, serialNum, tuneFileAttributes),
IndexMaintainerContext(threadingService, reconfigurer, fileHeaderContext, warmupExecutor),
_operations)
Expand Down
10 changes: 3 additions & 7 deletions searchcore/src/vespa/searchcore/proton/index/indexmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ namespace proton::index {

struct IndexConfig {
using WarmupConfig = searchcorespi::index::WarmupConfig;
IndexConfig() : IndexConfig(WarmupConfig(), 2, 0) { }
IndexConfig(WarmupConfig warmup_, size_t maxFlushed_, size_t dictionary_cache_size_in)
IndexConfig() : IndexConfig(WarmupConfig(), 2) { }
IndexConfig(WarmupConfig warmup_, size_t maxFlushed_)
: warmup(warmup_),
maxFlushed(maxFlushed_),
dictionary_cache_size(dictionary_cache_size_in)
maxFlushed(maxFlushed_)
{ }

const WarmupConfig warmup;
const size_t maxFlushed;
const size_t dictionary_cache_size;
};

/**
Expand All @@ -39,7 +37,6 @@ class IndexManager : public searchcorespi::IIndexManager
using IDiskIndex = searchcorespi::index::IDiskIndex;
using IMemoryIndex = searchcorespi::index::IMemoryIndex;
std::shared_ptr<search::diskindex::IPostingListCache> _posting_list_cache;
const size_t _dictionary_cache_size;
const search::common::FileHeaderContext &_fileHeaderContext;
const search::TuneFileIndexing _tuneFileIndexing;
const search::TuneFileSearch _tuneFileSearch;
Expand All @@ -49,7 +46,6 @@ class IndexManager : public searchcorespi::IIndexManager
MaintainerOperations(const search::common::FileHeaderContext &fileHeaderContext,
const search::TuneFileIndexManager &tuneFileIndexManager,
std::shared_ptr<search::diskindex::IPostingListCache> posting_list_cache,
size_t dictionary_cache_size,
searchcorespi::index::IThreadingService &threadingService);

IMemoryIndex::SP createMemoryIndex(const Schema& schema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace {

index::IndexConfig
makeIndexConfig(const ProtonConfig::Index & cfg) {
return {WarmupConfig(vespalib::from_s(cfg.warmup.time), cfg.warmup.unpack), size_t(cfg.maxflushed), size_t(cfg.cache.size)};
return {WarmupConfig(vespalib::from_s(cfg.warmup.time), cfg.warmup.unpack), size_t(cfg.maxflushed)};
}

ReplayThrottlingPolicy
Expand Down
1 change: 0 additions & 1 deletion searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ using search::fakedata::FPFactory;
using search::fakedata::FakePosting;
using search::fakedata::FakeWord;
using search::fakedata::getFPFactory;
using LookupResult = DiskIndex::LookupResult;

namespace {

Expand Down
Loading

0 comments on commit 3f540e7

Please sign in to comment.