From a543ff22f5678b0582de19b4a835eda23ef5ebf2 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 21 Oct 2024 14:55:46 +0800 Subject: [PATCH] revert logical changes Signed-off-by: Bugen Zhao --- src/frontend/src/catalog/schema_catalog.rs | 62 +++++++--------------- 1 file changed, 18 insertions(+), 44 deletions(-) diff --git a/src/frontend/src/catalog/schema_catalog.rs b/src/frontend/src/catalog/schema_catalog.rs index 3221f40aa1c28..0394da2a70f81 100644 --- a/src/frontend/src/catalog/schema_catalog.rs +++ b/src/frontend/src/catalog/schema_catalog.rs @@ -160,11 +160,7 @@ impl SchemaCatalog { } pub fn drop_table(&mut self, id: TableId) { - let Some(table_ref) = self.table_by_id.remove(&id) else { - tracing::warn!(?id, "table to drop not found, cleaning up?"); - return; - }; - + let table_ref = self.table_by_id.remove(&id).unwrap(); self.table_by_name.remove(&table_ref.name).unwrap(); self.indexes_by_table_id.remove(&table_ref.id); } @@ -194,11 +190,7 @@ impl SchemaCatalog { } pub fn drop_index(&mut self, id: IndexId) { - let Some(index_ref) = self.index_by_id.remove(&id) else { - tracing::warn!(?id, "index to drop not found, cleaning up?"); - return; - }; - + let index_ref = self.index_by_id.remove(&id).unwrap(); self.index_by_name.remove(&index_ref.name).unwrap(); match self.indexes_by_table_id.entry(index_ref.primary_table.id) { Occupied(mut entry) => { @@ -233,11 +225,7 @@ impl SchemaCatalog { } pub fn drop_source(&mut self, id: SourceId) { - let Some(source_ref) = self.source_by_id.remove(&id) else { - tracing::warn!(?id, "source to drop not found, cleaning up?"); - return; - }; - + let source_ref = self.source_by_id.remove(&id).unwrap(); self.source_by_name.remove(&source_ref.name).unwrap(); if let Some(connection_id) = source_ref.connection_id { if let Occupied(mut e) = self.connection_source_ref.entry(connection_id) { @@ -286,11 +274,7 @@ impl SchemaCatalog { } pub fn drop_sink(&mut self, id: SinkId) { - let Some(sink_ref) = self.sink_by_id.remove(&id) else { - tracing::warn!(?id, "sink to drop not found, cleaning up?"); - return; - }; - + let sink_ref = self.sink_by_id.remove(&id).unwrap(); self.sink_by_name.remove(&sink_ref.name).unwrap(); if let Some(connection_id) = sink_ref.connection_id { if let Occupied(mut e) = self.connection_sink_ref.entry(connection_id.0) { @@ -334,11 +318,7 @@ impl SchemaCatalog { } pub fn drop_subscription(&mut self, id: SubscriptionId) { - let Some(subscription_ref) = self.subscription_by_id.remove(&id) else { - tracing::warn!(?id, "subscription to drop not found, cleaning up?"); - return; - }; - + let subscription_ref = self.subscription_by_id.remove(&id).unwrap(); self.subscription_by_name .remove(&subscription_ref.name) .unwrap(); @@ -374,11 +354,7 @@ impl SchemaCatalog { } pub fn drop_view(&mut self, id: ViewId) { - let Some(view_ref) = self.view_by_id.remove(&id) else { - tracing::warn!(?id, "view to drop not found, cleaning up?"); - return; - }; - + let view_ref = self.view_by_id.remove(&id).unwrap(); self.view_by_name.remove(&view_ref.name).unwrap(); } @@ -435,10 +411,10 @@ impl SchemaCatalog { } pub fn drop_function(&mut self, id: FunctionId) { - let Some(function_ref) = self.function_by_id.remove(&id) else { - tracing::warn!(?id, "function to drop not found, cleaning up?"); - return; - }; + let function_ref = self + .function_by_id + .remove(&id) + .expect("function not found by id"); self.function_registry .remove(Self::get_func_sign(&function_ref)) @@ -507,11 +483,10 @@ impl SchemaCatalog { } pub fn drop_connection(&mut self, connection_id: ConnectionId) { - let Some(connection_ref) = self.connection_by_id.remove(&connection_id) else { - tracing::warn!(?connection_id, "connection to drop not found, cleaning up?"); - return; - }; - + let connection_ref = self + .connection_by_id + .remove(&connection_id) + .expect("connection not found by id"); self.connection_by_name .remove(&connection_ref.name) .expect("connection not found by name"); @@ -548,11 +523,10 @@ impl SchemaCatalog { } pub fn drop_secret(&mut self, secret_id: SecretId) { - let Some(secret_ref) = self.secret_by_id.remove(&secret_id) else { - tracing::warn!(?secret_id, "secret to drop not found, cleaning up?"); - return; - }; - + let secret_ref = self + .secret_by_id + .remove(&secret_id) + .expect("secret not found by id"); self.secret_by_name .remove(&secret_ref.name) .expect("secret not found by name");