Add debug messages around timeline.get_current_logical_size

This commit is contained in:
Anastasia Lubennikova
2023-02-14 16:31:06 +02:00
parent 3569c1bacd
commit a5ce2b5330
2 changed files with 19 additions and 11 deletions

View File

@@ -166,17 +166,20 @@ pub async fn collect_metrics_iteration(
match timeline.get_current_logical_size(ctx) {
// Only send timeline logical size when it is fully calculated.
Ok((size, is_exact)) if is_exact => {
current_metrics.push((
PageserverConsumptionMetricsKey {
tenant_id,
timeline_id: Some(timeline.timeline_id),
metric: TIMELINE_LOGICAL_SIZE,
},
size,
));
Ok((size, is_exact)) => {
if is_exact {
current_metrics.push((
PageserverConsumptionMetricsKey {
tenant_id,
timeline_id: Some(timeline.timeline_id),
metric: TIMELINE_LOGICAL_SIZE,
},
size,
));
} else {
info!("logical_size is not fully calculated for timeline {}, skipping sending value {} ", timeline.timeline_id, size);
}
}
Ok((_, _)) => {}
Err(err) => {
error!(
"failed to get current logical size for timeline {}: {err:?}",

View File

@@ -740,10 +740,15 @@ impl Timeline {
let mut is_exact = true;
let size = current_size.size();
if let (CurrentLogicalSize::Approximate(_), Some(init_lsn)) =
if let (CurrentLogicalSize::Approximate(approx_size), Some(init_lsn)) =
(current_size, self.current_logical_size.initial_part_end)
{
is_exact = false;
info!(
"Current size for timeline {} is approximate {}, initial_part_end lsn: {:?}",
self.timeline_id, approx_size, init_lsn
);
self.try_spawn_size_init_task(init_lsn, ctx);
}