mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 04:41:46 +03:00
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:
parent
0f3cfaa1af
commit
8aa3dce8cf
@ -115,23 +115,35 @@ pub async fn table_to_query(
|
||||
if info.bounds.is_none() {
|
||||
match bounds_type {
|
||||
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);
|
||||
if bounds_type == BoundsCalcType::Calc {
|
||||
info.bounds = bounds.await?;
|
||||
pin_mut!(bounds);
|
||||
if let Ok(bounds) = timeout(DEFAULT_BOUNDS_TIMEOUT, &mut bounds).await {
|
||||
info.bounds = bounds?;
|
||||
} else {
|
||||
pin_mut!(bounds);
|
||||
if let Ok(bounds) = timeout(DEFAULT_BOUNDS_TIMEOUT, &mut bounds).await {
|
||||
info.bounds = bounds?;
|
||||
} else {
|
||||
warn!(
|
||||
warn!(
|
||||
"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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user