Skip to content

Commit a3f3da7

Browse files
committed
Revert "store: pass list of indexes when pruning a subgraph"
This reverts commit cd6d04c.
1 parent cd6d04c commit a3f3da7

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

store/postgres/src/relational/index.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -734,16 +734,6 @@ pub struct IndexList {
734734
pub(crate) indexes: HashMap<String, Vec<CreateIndex>>,
735735
}
736736

737-
pub fn load_indexes_from_table(
738-
conn: &mut PgConnection,
739-
table: &Arc<Table>,
740-
schema_name: &str,
741-
) -> Result<Vec<CreateIndex>, StoreError> {
742-
let table_name = table.name.as_str();
743-
let indexes = catalog::indexes_for_table(conn, schema_name, table_name)?;
744-
Ok(indexes.into_iter().map(CreateIndex::parse).collect())
745-
}
746-
747737
impl IndexList {
748738
pub fn load(
749739
conn: &mut PgConnection,
@@ -756,8 +746,10 @@ impl IndexList {
756746
let schema_name = site.namespace.clone();
757747
let layout = store.layout(conn, site)?;
758748
for (_, table) in &layout.tables {
759-
let indexes = load_indexes_from_table(conn, table, schema_name.as_str())?;
760-
list.indexes.insert(table.name.to_string(), indexes);
749+
let table_name = table.name.as_str();
750+
let indexes = catalog::indexes_for_table(conn, schema_name.as_str(), table_name)?;
751+
let collect: Vec<CreateIndex> = indexes.into_iter().map(CreateIndex::parse).collect();
752+
list.indexes.insert(table_name.to_string(), collect);
761753
}
762754
Ok(list)
763755
}

store/postgres/src/relational/prune.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{collections::HashMap, fmt::Write, sync::Arc, time::Instant};
1+
use std::{fmt::Write, sync::Arc, time::Instant};
22

33
use diesel::{
44
connection::SimpleConnection,
@@ -24,10 +24,7 @@ use crate::{
2424
relational::{Table, VID_COLUMN},
2525
};
2626

27-
use super::{
28-
index::{load_indexes_from_table, IndexList},
29-
Catalog, Layout, Namespace,
30-
};
27+
use super::{Catalog, Layout, Namespace};
3128

3229
// Additions to `Table` that are useful for pruning
3330
impl Table {
@@ -97,15 +94,9 @@ impl TablePair {
9794
if catalog::table_exists(conn, dst_nsp.as_str(), &dst.name)? {
9895
writeln!(query, "truncate table {};", dst.qualified_name)?;
9996
} else {
100-
let mut list = IndexList {
101-
indexes: HashMap::new(),
102-
};
103-
let indexes = load_indexes_from_table(conn, &src, dst_nsp.as_str())?;
104-
list.indexes.insert(src.name.to_string(), indexes);
105-
10697
// In case of pruning we don't do delayed creation of indexes,
10798
// as the asumption is that there is not that much data inserted.
108-
dst.as_ddl(schema, catalog, Some(&list), &mut query)?;
99+
dst.as_ddl(schema, catalog, None, &mut query)?;
109100
}
110101
conn.batch_execute(&query)?;
111102

0 commit comments

Comments
 (0)