This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 6eee338c1e6 [fix](filecache) fix global metrics leakage when stat is 
nullptr (#59925)
6eee338c1e6 is described below

commit 6eee338c1e6fab198193f4cbf74910724d86c125
Author: zhengyu <[email protected]>
AuthorDate: Sat Jan 24 02:12:43 2026 +0800

    [fix](filecache) fix global metrics leakage when stat is nullptr (#59925)
    
    The original semantics of this defer are equivalent to:
    - Not only must is_dryrun == false,
    - but io_ctx->file_cache_stats must also be non-null.
    - Only then will two things happen simultaneously:
    - update io_ctx->file_cache_stats in the query profile
    - create fcache_stats_increment and update the global FileCacheProfile
    In other words, if io_ctx->file_cache_stats is null, the global
    FileCacheProfile is left untouched.
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
    
    Signed-off-by: zhengyu <[email protected]>
---
 be/src/io/cache/cached_remote_file_reader.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/be/src/io/cache/cached_remote_file_reader.cpp 
b/be/src/io/cache/cached_remote_file_reader.cpp
index d5216b26c0e..adc2d507011 100644
--- a/be/src/io/cache/cached_remote_file_reader.cpp
+++ b/be/src/io/cache/cached_remote_file_reader.cpp
@@ -313,13 +313,16 @@ Status CachedRemoteFileReader::read_at_impl(size_t 
offset, Slice result, size_t*
                     path().native(), offset, bytes_req, 
read_at_sw.elapsed_time_milliseconds(),
                     io_ctx->is_warmup);
         }
-        if (io_ctx->file_cache_stats && !is_dryrun) {
+        if (is_dryrun) {
+            return;
+        }
+        // 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::FileCacheMetrics::instance().update(&fcache_stats_increment);
+        if (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::FileCacheMetrics::instance().update(&fcache_stats_increment);
         }
     };
     std::unique_ptr<int, decltype(defer_func)> defer((int*)0x01, 
std::move(defer_func));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to