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

yiguolei 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 cc36b378c19 [bugfix](counter) fix read uncompressed counter is wrong 
(#56677)
cc36b378c19 is described below

commit cc36b378c191faf7fc1fede0240e545b504c074a
Author: yiguolei <[email protected]>
AuthorDate: Tue Sep 30 23:15:21 2025 +0800

    [bugfix](counter) fix read uncompressed counter is wrong (#56677)
---
 be/src/vec/exec/scan/olap_scanner.cpp | 17 +++++++++--------
 be/src/vec/exec/scan/olap_scanner.h   |  3 +++
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/be/src/vec/exec/scan/olap_scanner.cpp 
b/be/src/vec/exec/scan/olap_scanner.cpp
index 614c09c5e3f..bbd557d2834 100644
--- a/be/src/vec/exec/scan/olap_scanner.cpp
+++ b/be/src/vec/exec/scan/olap_scanner.cpp
@@ -602,6 +602,7 @@ void OlapScanner::update_realtime_counters() {
             static_cast<pipeline::OlapScanLocalState*>(_local_state);
     const OlapReaderStatistics& stats = _tablet_reader->stats();
     COUNTER_UPDATE(local_state->_read_compressed_counter, 
stats.compressed_bytes_read);
+    COUNTER_UPDATE(local_state->_read_uncompressed_counter, 
stats.uncompressed_bytes_read);
     COUNTER_UPDATE(local_state->_scan_bytes, stats.uncompressed_bytes_read);
     COUNTER_UPDATE(local_state->_scan_rows, stats.raw_rows_read);
 
@@ -624,25 +625,25 @@ void OlapScanner::update_realtime_counters() {
                 stats.compressed_bytes_read);
     } else {
         
_state->get_query_ctx()->resource_ctx()->io_context()->update_scan_bytes_from_local_storage(
-                stats.file_cache_stats.bytes_read_from_local);
+                stats.file_cache_stats.bytes_read_from_local - 
_bytes_read_from_local);
         _state->get_query_ctx()
                 ->resource_ctx()
                 ->io_context()
                 ->update_scan_bytes_from_remote_storage(
-                        stats.file_cache_stats.bytes_read_from_remote);
-        io::FileCacheProfileReporter 
cache_profile(local_state->_segment_profile.get());
-        cache_profile.update(&stats.file_cache_stats);
+                        stats.file_cache_stats.bytes_read_from_remote - 
_bytes_read_from_remote);
+
         DorisMetrics::instance()->query_scan_bytes_from_local->increment(
-                stats.file_cache_stats.bytes_read_from_local);
+                stats.file_cache_stats.bytes_read_from_local - 
_bytes_read_from_local);
         DorisMetrics::instance()->query_scan_bytes_from_remote->increment(
-                stats.file_cache_stats.bytes_read_from_remote);
+                stats.file_cache_stats.bytes_read_from_remote - 
_bytes_read_from_remote);
     }
 
     _tablet_reader->mutable_stats()->compressed_bytes_read = 0;
     _tablet_reader->mutable_stats()->uncompressed_bytes_read = 0;
     _tablet_reader->mutable_stats()->raw_rows_read = 0;
-    _tablet_reader->mutable_stats()->file_cache_stats.bytes_read_from_local = 
0;
-    _tablet_reader->mutable_stats()->file_cache_stats.bytes_read_from_remote = 
0;
+
+    _bytes_read_from_local = 
_tablet_reader->stats().file_cache_stats.bytes_read_from_local;
+    _bytes_read_from_remote = 
_tablet_reader->stats().file_cache_stats.bytes_read_from_remote;
 }
 
 void OlapScanner::_collect_profile_before_close() {
diff --git a/be/src/vec/exec/scan/olap_scanner.h 
b/be/src/vec/exec/scan/olap_scanner.h
index f12b3f37444..8f14889222b 100644
--- a/be/src/vec/exec/scan/olap_scanner.h
+++ b/be/src/vec/exec/scan/olap_scanner.h
@@ -101,6 +101,9 @@ private:
     TabletReader::ReaderParams _tablet_reader_params;
     std::unique_ptr<TabletReader> _tablet_reader;
 
+    int64_t _bytes_read_from_local = 0;
+    int64_t _bytes_read_from_remote = 0;
+
 public:
     std::vector<ColumnId> _return_columns;
 


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

Reply via email to