Better bounds debugging (#1180)

Add debug logging for bounds -- seems like this has been a big point of
contention / slow startups
This commit is contained in:
Yuri Astrakhan 2024-02-06 19:18:14 -05:00 committed by GitHub
parent 0f3cfaa1af
commit 8aa3dce8cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,23 +115,35 @@ pub async fn table_to_query(
if info.bounds.is_none() { if info.bounds.is_none() {
match bounds_type { match bounds_type {
BoundsCalcType::Skip => {} BoundsCalcType::Skip => {}
BoundsCalcType::Quick | BoundsCalcType::Calc => { BoundsCalcType::Calc => {
debug!("Computing {} table bounds for {id}", info.format_id());
info.bounds = calc_bounds(&pool, &schema, &table, &geometry_column, srid).await?;
}
BoundsCalcType::Quick => {
debug!(
"Computing {} table bounds with {}s timeout for {id}",
info.format_id(),
DEFAULT_BOUNDS_TIMEOUT.as_secs()
);
let bounds = calc_bounds(&pool, &schema, &table, &geometry_column, srid); let bounds = calc_bounds(&pool, &schema, &table, &geometry_column, srid);
if bounds_type == BoundsCalcType::Calc { pin_mut!(bounds);
info.bounds = bounds.await?; if let Ok(bounds) = timeout(DEFAULT_BOUNDS_TIMEOUT, &mut bounds).await {
info.bounds = bounds?;
} else { } else {
pin_mut!(bounds); warn!(
if let Ok(bounds) = timeout(DEFAULT_BOUNDS_TIMEOUT, &mut bounds).await {
info.bounds = bounds?;
} else {
warn!(
"Timeout computing {} bounds for {id}, aborting query. Use --auto-bounds=calc to wait until complete, or check the table for missing indices.", "Timeout computing {} bounds for {id}, aborting query. Use --auto-bounds=calc to wait until complete, or check the table for missing indices.",
info.format_id(), info.format_id(),
); );
}
} }
} }
} }
if let Some(bounds) = info.bounds {
debug!(
"The computed bounds for {id} from {} are {bounds}",
info.format_id()
);
}
} }
let properties = if let Some(props) = &info.properties { let properties = if let Some(props) = &info.properties {