This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push: new 9723bb62f [CFileSet] reuse key index reader pointer 9723bb62f is described below commit 9723bb62fd01ad45c817aa0967ac068360b8741d Author: Alexey Serbin <ale...@apache.org> AuthorDate: Wed Sep 11 15:56:00 2024 -0700 [CFileSet] reuse key index reader pointer Avoid multiple calls to CFileSet::key_index_reader() when it's possible to re-use the result of the very first invocation. This patch doesn't contain any functional modifications. Change-Id: I3ea4a76192646729489dc98cdbb45308aa464eaf Reviewed-on: http://gerrit.cloudera.org:8080/21841 Reviewed-by: Yifan Zhang <chinazhangyi...@163.com> Tested-by: Alexey Serbin <ale...@apache.org> --- src/kudu/tablet/cfile_set.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/kudu/tablet/cfile_set.cc b/src/kudu/tablet/cfile_set.cc index 1bcdfaaea..a10fd4f11 100644 --- a/src/kudu/tablet/cfile_set.cc +++ b/src/kudu/tablet/cfile_set.cc @@ -208,7 +208,7 @@ Status CFileSet::OpenBloomReader(const IOContext* io_context) { Status CFileSet::LoadMinMaxKeys(const IOContext* io_context) { CFileReader* key_reader = key_index_reader(); - RETURN_NOT_OK(key_index_reader()->Init(io_context)); + RETURN_NOT_OK(key_reader->Init(io_context)); if (!key_reader->GetMetadataEntry(DiskRowSet::kMinKeyMetaEntryName, &min_encoded_key_)) { return Status::Corruption("No min key found", ToString()); } @@ -245,8 +245,9 @@ unique_ptr<CFileSet::Iterator> CFileSet::NewIterator( } Status CFileSet::CountRows(const IOContext* io_context, rowid_t *count) const { - RETURN_NOT_OK(key_index_reader()->Init(io_context)); - return key_index_reader()->CountRows(count); + CFileReader* key_reader = key_index_reader(); + RETURN_NOT_OK(key_reader->Init(io_context)); + return key_reader->CountRows(count); } Status CFileSet::GetBounds(string* min_encoded_key, @@ -341,8 +342,9 @@ Status CFileSet::CheckRowPresent(const RowSetKeyProbe& probe, const IOContext* i Status CFileSet::NewKeyIterator(const IOContext* io_context, unique_ptr<CFileIterator>* key_iter) const { - RETURN_NOT_OK(key_index_reader()->Init(io_context)); - return key_index_reader()->NewIterator(key_iter, CFileReader::CACHE_BLOCK, io_context); + CFileReader* key_reader = key_index_reader(); + RETURN_NOT_OK(key_reader->Init(io_context)); + return key_reader->NewIterator(key_iter, CFileReader::CACHE_BLOCK, io_context); } ////////////////////////////////////////////////////////////