Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pick 2.1](inverted index) add inverted index reader memory size into searcher cache #36160

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions be/src/olap/rowset/segment_v2/inverted_index_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ Status InvertedIndexReader::create_index_searcher(lucene::store::Directory* dir,
if (std::string(dir->getObjectName()) == "DorisCompoundReader") {
static_cast<DorisCompoundReader*>(dir)->getDorisIndexInput()->setIdxFileCache(false);
}
// NOTE: before mem_tracker hook becomes active, we caculate reader memory size by hand.
mem_tracker->consume(index_searcher_builder->get_reader_size());
return Status::OK();
};

Expand Down
1 change: 1 addition & 0 deletions be/src/olap/rowset/segment_v2/inverted_index_searcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Status FulltextIndexSearcherBuilder::build(lucene::store::Directory* directory,
return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
"FulltextIndexSearcherBuilder build index_searcher error.");
}
reader_size = reader->getTermInfosRAMUsed();
// NOTE: need to cl_refcount-- here, so that directory will be deleted when
// index_searcher is destroyed
_CLDECDELETE(directory)
Expand Down
4 changes: 4 additions & 0 deletions be/src/olap/rowset/segment_v2/inverted_index_searcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class IndexSearcherBuilder {
virtual Result<IndexSearcherPtr> get_index_searcher(lucene::store::Directory* directory);
static Result<std::unique_ptr<IndexSearcherBuilder>> create_index_searcher_builder(
InvertedIndexReaderType reader_type);
int64_t get_reader_size() const { return reader_size; }

protected:
int64_t reader_size = 0;
};

class FulltextIndexSearcherBuilder : public IndexSearcherBuilder {
Expand Down
Loading