Skip to content

Commit

Permalink
Merge pull request #32742 from vespa-engine/toregge/rename-cache-size…
Browse files Browse the repository at this point in the history
…-to-dictionary-cache-size

Rename cacheSize to dictionary_cache_size.
  • Loading branch information
toregge authored Nov 1, 2024
2 parents 952e224 + dedb906 commit 89668f2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace proton {
DiskIndexWrapper::DiskIndexWrapper(const std::string &indexDir,
const TuneFileSearch &tuneFileSearch,
std::shared_ptr<IPostingListCache> posting_list_cache,
size_t cacheSize)
: _index(indexDir, std::move(posting_list_cache), cacheSize),
size_t dictionary_cache_size)
: _index(indexDir, std::move(posting_list_cache), dictionary_cache_size),
_serialNum(0)
{
bool setupIndexOk = _index.setup(tuneFileSearch);
Expand All @@ -26,8 +26,8 @@ DiskIndexWrapper::DiskIndexWrapper(const std::string &indexDir,

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

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

std::unique_ptr<search::queryeval::Blueprint>
createBlueprint(const IRequestContext & requestContext, const FieldSpec &field, const Node &term) override {
Expand Down
10 changes: 5 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,10 @@ namespace proton::index {
IndexManager::MaintainerOperations::MaintainerOperations(const FileHeaderContext &fileHeaderContext,
const TuneFileIndexManager &tuneFileIndexManager,
std::shared_ptr<IPostingListCache> posting_list_cache,
size_t cacheSize,
size_t dictionary_cache_size,
IThreadingService &threadingService)
: _posting_list_cache(std::move(posting_list_cache)),
_cacheSize(cacheSize),
_dictionary_cache_size(dictionary_cache_size),
_fileHeaderContext(fileHeaderContext),
_tuneFileIndexing(tuneFileIndexManager._indexing),
_tuneFileSearch(tuneFileIndexManager._search),
Expand All @@ -54,14 +54,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, _cacheSize);
return std::make_shared<DiskIndexWrapper>(indexDir, _tuneFileSearch, _posting_list_cache, _dictionary_cache_size);
}

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

bool
Expand Down Expand Up @@ -90,7 +90,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.cacheSize, threadingService),
_operations(fileHeaderContext, tuneFileIndexManager, std::move(posting_list_cache), indexConfig.dictionary_cache_size, threadingService),
_maintainer(IndexMaintainerConfig(baseDir, indexConfig.warmup, indexConfig.maxFlushed, schema, serialNum, tuneFileAttributes),
IndexMaintainerContext(threadingService, reconfigurer, fileHeaderContext, warmupExecutor),
_operations)
Expand Down
10 changes: 5 additions & 5 deletions searchcore/src/vespa/searchcore/proton/index/indexmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ namespace proton::index {
struct IndexConfig {
using WarmupConfig = searchcorespi::index::WarmupConfig;
IndexConfig() : IndexConfig(WarmupConfig(), 2, 0) { }
IndexConfig(WarmupConfig warmup_, size_t maxFlushed_, size_t cacheSize_)
IndexConfig(WarmupConfig warmup_, size_t maxFlushed_, size_t dictionary_cache_size_in)
: warmup(warmup_),
maxFlushed(maxFlushed_),
cacheSize(cacheSize_)
dictionary_cache_size(dictionary_cache_size_in)
{ }

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

/**
Expand All @@ -39,7 +39,7 @@ 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 _cacheSize;
const size_t _dictionary_cache_size;
const search::common::FileHeaderContext &_fileHeaderContext;
const search::TuneFileIndexing _tuneFileIndexing;
const search::TuneFileSearch _tuneFileSearch;
Expand All @@ -49,7 +49,7 @@ 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 cacheSize,
size_t dictionary_cache_size,
searchcorespi::index::IThreadingService &threadingService);

IMemoryIndex::SP createMemoryIndex(const Schema& schema,
Expand Down
8 changes: 4 additions & 4 deletions searchlib/src/vespa/searchlib/diskindex/diskindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ DiskIndex::Key::Key(const Key &) = default;
DiskIndex::Key & DiskIndex::Key::operator = (const Key &) = default;
DiskIndex::Key::~Key() = default;

DiskIndex::DiskIndex(const std::string &indexDir, std::shared_ptr<IPostingListCache> posting_list_cache, size_t cacheSize)
DiskIndex::DiskIndex(const std::string &indexDir, std::shared_ptr<IPostingListCache> posting_list_cache, size_t dictionary_cache_size)
: _indexDir(indexDir),
_cacheSize(cacheSize),
_dictionary_cache_size(dictionary_cache_size),
_schema(),
_field_indexes(),
_nonfield_size_on_disk(0),
_tuneFileSearch(),
_posting_list_cache(std::move(posting_list_cache)),
_cache(*this, cacheSize)
_cache(*this, dictionary_cache_size)
{
calculate_nonfield_size_on_disk();
}
Expand Down Expand Up @@ -198,7 +198,7 @@ DiskIndex::lookup(const std::vector<uint32_t> & indexes, std::string_view word)
{
Key key(indexes, word);
LookupResultVector result;
if (_cacheSize > 0) {
if (_dictionary_cache_size > 0) {
result = _cache.read(key);
if (!containsAll(indexes, result)) {
key = Key(unite(indexes, result), word);
Expand Down
6 changes: 3 additions & 3 deletions searchlib/src/vespa/searchlib/diskindex/diskindex.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DiskIndex : public queryeval::Searchable {
using Cache = vespalib::cache<vespalib::CacheParam<vespalib::LruParam<Key, LookupResultVector>, DiskIndex>>;

std::string _indexDir;
size_t _cacheSize;
size_t _dictionary_cache_size;
index::Schema _schema;
std::vector<FieldIndex> _field_indexes;
uint32_t _nonfield_size_on_disk;
Expand All @@ -74,10 +74,10 @@ class DiskIndex : public queryeval::Searchable {
* Create a view of the disk index located in the given directory.
*
* @param indexDir the directory where the disk index is located.
* @param cacheSize optional size (in bytes) of the disk dictionary lookup cache.
* @param dictionary_cache_size optional size (in bytes) of the disk dictionary lookup cache.
*/
explicit DiskIndex(const std::string &indexDir, std::shared_ptr<IPostingListCache> posting_list_cache,
size_t cacheSize = 0);
size_t dictionary_cache_size = 0);
~DiskIndex() override;

/**
Expand Down

0 comments on commit 89668f2

Please sign in to comment.