Skip to content

Commit 2d03de8

Browse files
committed
store: Asyncify Layout.analyze_tables
1 parent c4d5c3b commit 2d03de8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

store/postgres/src/relational/prune.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl TablePair {
263263
impl Layout {
264264
/// Analyze the `tables` and return `VersionStats` for all tables in
265265
/// this `Layout`
266-
fn analyze_tables(
266+
async fn analyze_tables(
267267
&self,
268268
conn: &mut PgConnection,
269269
reporter: &mut dyn PruneReporter,
@@ -290,7 +290,7 @@ impl Layout {
290290
/// is `true`, analyze all tables before getting statistics. If it is
291291
/// `false`, only analyze tables that Postgres' autovacuum daemon would
292292
/// consider needing analysis.
293-
fn version_stats(
293+
async fn version_stats(
294294
&self,
295295
conn: &mut PgConnection,
296296
reporter: &mut dyn PruneReporter,
@@ -308,7 +308,7 @@ impl Layout {
308308
.filter(|table| analyze_all || needs_analyze.contains(&table.name))
309309
.collect();
310310

311-
self.analyze_tables(conn, reporter, tables, cancel)
311+
self.analyze_tables(conn, reporter, tables, cancel).await
312312
}
313313

314314
/// Return all tables and the strategy to prune them withir stats whose ratio of distinct entities
@@ -416,7 +416,7 @@ impl Layout {
416416
tracker: &status::Tracker,
417417
) -> Result<(), CancelableError<StoreError>> {
418418
reporter.start(req);
419-
let stats = self.version_stats(conn, reporter, true, cancel)?;
419+
let stats = self.version_stats(conn, reporter, true, cancel).await?;
420420
let prunable_tables: Vec<_> = self.prunable_tables(&stats, req).into_iter().collect();
421421
tracker.start(conn, req, &prunable_tables).await?;
422422
let dst_nsp = Namespace::prune(self.site.id);
@@ -517,7 +517,7 @@ impl Layout {
517517
catalog::set_last_pruned_block(conn, &self.site, &table.name, req.earliest_block)?;
518518
}
519519
let tables = prunable_tables.iter().map(|(table, _)| *table).collect();
520-
self.analyze_tables(conn, reporter, tables, cancel)?;
520+
self.analyze_tables(conn, reporter, tables, cancel).await?;
521521
reporter.finish();
522522
Ok(())
523523
}

0 commit comments

Comments
 (0)