Skip to content

Commit c4d5c3b

Browse files
committed
store: Asyncify relational::load_indexes_from_table
1 parent 474a7bc commit c4d5c3b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

store/postgres/src/relational/index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ pub struct IndexList {
752752
pub(crate) indexes: HashMap<String, Vec<CreateIndex>>,
753753
}
754754

755-
pub fn load_indexes_from_table(
755+
pub async fn load_indexes_from_table(
756756
conn: &mut PgConnection,
757757
table: &Arc<Table>,
758758
schema_name: &str,
@@ -774,7 +774,7 @@ impl IndexList {
774774
let schema_name = site.namespace.clone();
775775
let layout = store.layout(conn, site).await?;
776776
for (_, table) in &layout.tables {
777-
let indexes = load_indexes_from_table(conn, table, schema_name.as_str())?;
777+
let indexes = load_indexes_from_table(conn, table, schema_name.as_str()).await?;
778778
list.indexes.insert(table.name.to_string(), indexes);
779779
}
780780
Ok(list)

store/postgres/src/relational/prune.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl TablePair {
5151
/// Create a `TablePair` for `src`. This creates a new table `dst` with
5252
/// the same structure as the `src` table in the database, but in a
5353
/// different namespace so that the names of indexes etc. don't clash
54-
fn create(
54+
async fn create(
5555
conn: &mut PgConnection,
5656
src: Arc<Table>,
5757
src_nsp: Namespace,
@@ -68,7 +68,8 @@ impl TablePair {
6868
let mut list = IndexList {
6969
indexes: HashMap::new(),
7070
};
71-
let indexes = load_indexes_from_table(conn, &src, src_nsp.as_str())?
71+
let indexes = load_indexes_from_table(conn, &src, src_nsp.as_str())
72+
.await?
7273
.into_iter()
7374
.map(|index| index.with_nsp(dst_nsp.to_string()))
7475
.collect::<Result<Vec<CreateIndex>, _>>()?;
@@ -436,7 +437,8 @@ impl Layout {
436437
dst_nsp.clone(),
437438
&self.input_schema,
438439
&self.catalog,
439-
)?;
440+
)
441+
.await?;
440442
// Copy final entities. This can happen in parallel to indexing as
441443
// that part of the table will not change
442444
pair.copy_final_entities(

0 commit comments

Comments
 (0)