Skip to content

Commit

Permalink
clean up orphaned table namespaces (#29680)
Browse files Browse the repository at this point in the history
In components push, we create a bunch of system and user tables in `start_push` that might not end up being used if `finish_push` is never called because of a validation error or other interruption. We should clean them up to avoid having tons of unused tables lying around.

GitOrigin-RevId: e73a29b9b435d70ae44131383445c18341a92700
  • Loading branch information
emmaling27 authored and Convex, Inc. committed Sep 9, 2024
1 parent 92cd087 commit 566cf59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/database/src/bootstrap_model/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl<'a, RT: Runtime> TableModel<'a, RT> {
Ok(())
}

async fn get_table_metadata(
pub async fn get_table_metadata(
&mut self,
tablet_id: TabletId,
) -> anyhow::Result<ParsedDocument<TableMetadata>> {
Expand Down
6 changes: 6 additions & 0 deletions crates/value/src/table_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ impl TableMapping {
})
}

pub fn iter_active_namespaces(
&self,
) -> impl Iterator<Item = (&TableNamespace, &OrdMap<TableName, TabletId>)> {
self.table_name_to_canonical_tablet.iter()
}

pub fn namespaces_for_name(&self, name: &TableName) -> Vec<TableNamespace> {
self.iter()
.filter(|(_, _, _, table_name)| *table_name == name)
Expand Down

0 comments on commit 566cf59

Please sign in to comment.