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: ignore collecting fetched bytes stats when sst file is read only once #1369

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Changes from 1 commit
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
12 changes: 8 additions & 4 deletions analytic_engine/src/sst/parquet/async_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ impl<'a> Reader<'a> {

let mut streams = Vec::with_capacity(target_row_group_chunks.len());
let metrics_collector = ObjectStoreMetricsObserver {
collect_fetched_bytes_stats: matches!(self.frequency, ReadFrequency::Frequent),
table_level_sst_metrics: self.table_level_sst_metrics.clone(),
};
for chunk in target_row_group_chunks {
Expand Down Expand Up @@ -763,18 +764,21 @@ impl<'a> SstReader for ThreadedReader<'a> {

#[derive(Clone)]
struct ObjectStoreMetricsObserver {
collect_fetched_bytes_stats: bool,
table_level_sst_metrics: Arc<MaybeTableLevelMetrics>,
}

impl MetricsObserver for ObjectStoreMetricsObserver {
fn elapsed(&self, path: &Path, elapsed: Duration) {
debug!("ObjectStoreReader dropped, path:{path}, elapsed:{elapsed:?}",);
debug!("ObjectStoreReader dropped, path:{path}, elapsed:{elapsed:?}");
}

fn num_bytes_fetched(&self, _: &Path, num_bytes: usize) {
self.table_level_sst_metrics
.num_fetched_sst_bytes
.fetch_add(num_bytes as u64, Ordering::Relaxed);
if self.collect_fetched_bytes_stats {
self.table_level_sst_metrics
.num_fetched_sst_bytes
.fetch_add(num_bytes as u64, Ordering::Relaxed);
}
}
}

Expand Down