diff --git a/crates/common/src/components/component_path.rs b/crates/common/src/components/component_path.rs index 206415a5..38fcad36 100644 --- a/crates/common/src/components/component_path.rs +++ b/crates/common/src/components/component_path.rs @@ -1,5 +1,8 @@ use std::{ - fmt::Display, + fmt::{ + Debug, + Display, + }, ops::Deref, path::PathBuf, str::FromStr, @@ -72,7 +75,7 @@ impl HeapSize for ComponentName { // path can potentially change when the component tree changes during a push, so // we should resolve this path to a `ComponentId` within a transaction // as soon as possible. -#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default)] +#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default)] #[cfg_attr(any(test, feature = "testing"), derive(proptest_derive::Arbitrary))] pub struct ComponentPath { path: WithHeapSize>, @@ -174,6 +177,12 @@ impl Display for ComponentPath { } } +impl Debug for ComponentPath { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", *self.path) + } +} + impl FromStr for ComponentPath { type Err = anyhow::Error; diff --git a/crates/database/src/bootstrap_model/table.rs b/crates/database/src/bootstrap_model/table.rs index 15356217..3bcd65c7 100644 --- a/crates/database/src/bootstrap_model/table.rs +++ b/crates/database/src/bootstrap_model/table.rs @@ -188,17 +188,22 @@ impl<'a, RT: Runtime> TableModel<'a, RT> { .table_mapping() .namespace(namespace) .id(&table_name)?; - self.delete_table_by_id(table_id_and_number.tablet_id).await + self.delete_table_by_id_bypassing_schema_enforcement(table_id_and_number.tablet_id) + .await } pub async fn delete_hidden_table(&mut self, tablet_id: TabletId) -> anyhow::Result<()> { let table_metadata = self.get_table_metadata(tablet_id).await?; // We don't need to validate hidden table with the schema. anyhow::ensure!(table_metadata.state == TableState::Hidden); - self.delete_table_by_id(tablet_id).await + self.delete_table_by_id_bypassing_schema_enforcement(tablet_id) + .await } - pub async fn delete_table_by_id(&mut self, tablet_id: TabletId) -> anyhow::Result<()> { + async fn delete_table_by_id_bypassing_schema_enforcement( + &mut self, + tablet_id: TabletId, + ) -> anyhow::Result<()> { for index in IndexModel::new(self.tx) .all_indexes_on_table(tablet_id) .await? @@ -393,7 +398,7 @@ impl<'a, RT: Runtime> TableModel<'a, RT> { .namespace(namespace) .id(table_name)?; documents_deleted += self.count(namespace, table_name).await?; - self.delete_table_by_id(existing_table_by_name.tablet_id) + self.delete_table_by_id_bypassing_schema_enforcement(existing_table_by_name.tablet_id) .await?; } let table_metadata = TableMetadata::new_with_state( diff --git a/crates/model/src/components/config.rs b/crates/model/src/components/config.rs index 243f3a8c..7bd384b2 100644 --- a/crates/model/src/components/config.rs +++ b/crates/model/src/components/config.rs @@ -684,16 +684,6 @@ impl<'a, RT: Runtime> ComponentConfigModel<'a, RT> { FunctionHandlesModel::new(self.tx) .apply_config_diff(component_id, None) .await?; - let (schema_diff, next_schema) = SchemaModel::new(self.tx, component_id.into()) - .apply(None) - .await?; - let index_diff = IndexModel::new(self.tx) - .get_full_index_diff(component_id.into(), &next_schema) - .await? - .into(); - IndexModel::new(self.tx) - .apply(component_id.into(), &next_schema) - .await?; Ok(( existing.id().into(), ComponentDiff { @@ -701,8 +691,8 @@ impl<'a, RT: Runtime> ComponentConfigModel<'a, RT> { module_diff, udf_config_diff: None, cron_diff, - index_diff, - schema_diff, + index_diff: AuditLogIndexDiff::default(), + schema_diff: None, }, )) } @@ -755,9 +745,9 @@ impl<'a, RT: Runtime> ComponentConfigModel<'a, RT> { // then delete all tables, including system tables let namespaced_table_mapping = self.tx.table_mapping().namespace(namespace); - for (tablet_id, ..) in namespaced_table_mapping.iter() { + for (_, _, table_name) in namespaced_table_mapping.iter() { TableModel::new(self.tx) - .delete_table_by_id(tablet_id) + .delete_table(namespace, table_name.clone()) .await?; } }