github-actions[bot] commented on code in PR #70836:
URL: https://github.com/apache/doris/pull/70836#discussion_r4657612512
##########
be/src/exec/operator/olap_scan_operator.cpp:
##########
@@ -152,6 +152,11 @@ Status OlapScanLocalState::_init_profile() {
_tablets_pruned_by_tso_counter =
ADD_COUNTER(custom_profile(), "TabletsPrunedByTso", TUnit::UNIT);
_process_conjunct_timer = ADD_TIMER(custom_profile(),
"ProcessConjunctTime");
+ _bytes_scanned_from_cache =
+ ADD_COUNTER(_segment_profile, "BytesScannedFromCache",
TUnit::BYTES);
Review Comment:
[P2] Keep these byte counters in the merged query profile. `ADD_COUNTER`
gives the new root handles level 2, but the previous `FileCacheProfileReporter`
registered `BytesScannedFromCache`, `BytesScannedFromRemote`, and
`BytesWriteIntoCache` at level 1. BE therefore prunes them from
`profile_level=1`, and FE's `RuntimeProfile.mergeCounters` ignores level-2
leaves, so the counters disappear from the normal merged execution profile even
at level 2. Please register the root handles at level 1 (and add
level-1/merged-profile coverage) so moving them out of `FileCache` preserves
their existing visibility.
##########
be/src/exec/scan/olap_scanner.cpp:
##########
@@ -793,17 +793,24 @@ void OlapScanner::update_realtime_counters() {
stats.file_cache_stats.bytes_read_from_remote);
}
- if (has_file_cache_statistics(stats.file_cache_stats)) {
- io::FileCacheProfileReporter
cache_profile(local_state->_segment_profile.get());
- cache_profile.update(&stats.file_cache_stats);
-
_state->get_query_ctx()->resource_ctx()->io_context()->update_bytes_write_into_cache(
- stats.file_cache_stats.bytes_write_into_cache);
- }
+ COUNTER_UPDATE(local_state->_bytes_scanned_from_cache,
+ stats.file_cache_stats.bytes_read_from_local);
+ COUNTER_UPDATE(local_state->_bytes_scanned_from_remote,
+ stats.file_cache_stats.bytes_read_from_remote);
+ COUNTER_UPDATE(local_state->_bytes_write_into_cache,
+ stats.file_cache_stats.bytes_write_into_cache);
+
_state->get_query_ctx()->resource_ctx()->io_context()->update_bytes_write_into_cache(
+ stats.file_cache_stats.bytes_write_into_cache);
_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 are reported per batch; keep the remaining FileCache details for
collection at close.
Review Comment:
[P2] Do not defer all detail publication past scanner stop. When a query
reaches LIMIT or is cancelled, `ScanOperatorX` calls
`ScannerContext::stop_scanners()`, which only `try_stop()`s scanners;
destroying their delegates calls `OlapScanner::close()` without
`_collect_profile_before_close()`. A scanner that returned a non-EOS batch
therefore retains nonzero detailed FileCache stats that are never reported,
whereas the base code published them in `update_realtime_counters()` before
reset. Flush the retained details during stop/destruction (idempotently and
outside `_transfer_lock`) or keep a complete realtime path, and cover
LIMIT/cancellation in a profile test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]