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

[fix](metrics) Correct statistical method for file cache stats #47020

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 7 additions & 3 deletions be/src/io/cache/cached_remote_file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ Status CachedRemoteFileReader::read_at_impl(size_t offset, Slice result, size_t*
ReadStatistics stats;
auto defer_func = [&](int*) {
if (io_ctx->file_cache_stats) {
_update_state(stats, io_ctx->file_cache_stats, io_ctx->is_inverted_index);
io::FileCacheProfile::instance().update(io_ctx->file_cache_stats);
// update stats in io_ctx, for query profile
_update_stats(stats, io_ctx->file_cache_stats, io_ctx->is_inverted_index);
// update stats increment in this reading procedure for file cache metrics
FileCacheStatistics fcache_stats_increment;
_update_stats(stats, &fcache_stats_increment, io_ctx->is_inverted_index);
io::FileCacheProfile::instance().update(&fcache_stats_increment);
}
};
std::unique_ptr<int, decltype(defer_func)> defer((int*)0x01, std::move(defer_func));
Expand Down Expand Up @@ -316,7 +320,7 @@ Status CachedRemoteFileReader::read_at_impl(size_t offset, Slice result, size_t*
return Status::OK();
}

void CachedRemoteFileReader::_update_state(const ReadStatistics& read_stats,
void CachedRemoteFileReader::_update_stats(const ReadStatistics& read_stats,
FileCacheStatistics* statis,
bool is_inverted_index) const {
if (statis == nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion be/src/io/cache/cached_remote_file_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CachedRemoteFileReader final : public FileReader {
std::shared_mutex _mtx;
std::map<size_t, FileBlockSPtr> _cache_file_readers;

void _update_state(const ReadStatistics& stats, FileCacheStatistics* state,
void _update_stats(const ReadStatistics& stats, FileCacheStatistics* state,
bool is_inverted_index) const;
};

Expand Down
Loading