From c70ccee4a1d51cdc8a8aa0196fa531b78661ef06 Mon Sep 17 00:00:00 2001 From: Dom Dwyer Date: Tue, 31 Jan 2023 14:34:44 +0100 Subject: [PATCH] fix: disable namespace delete gRPC endpoint Do not allow this endpoint to be called - the logic is incorrect. --- service_grpc_namespace/src/lib.rs | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/service_grpc_namespace/src/lib.rs b/service_grpc_namespace/src/lib.rs index 36c131fe30..d132cd3e4c 100644 --- a/service_grpc_namespace/src/lib.rs +++ b/service_grpc_namespace/src/lib.rs @@ -85,32 +85,12 @@ impl namespace_service_server::NamespaceService for NamespaceService { async fn delete_namespace( &self, - request: Request, + _request: Request, ) -> Result, Status> { - if self.topic_id.is_none() || self.query_id.is_none() { - return Err(Status::invalid_argument("topic_id or query_id not set")); - } - let mut repos = self.catalog.repositories().await; - let DeleteNamespaceRequest { - name: namespace_name, - } = request.into_inner(); - - debug!(%namespace_name, "Deleting namespace"); - repos - .namespaces() - .delete(&namespace_name) - .await - .map_err(|e| match e { - iox_catalog::interface::Error::NamespaceNotFoundByName { name: _ } => { - Status::not_found(e.to_string()) - } - _ => { - warn!(error=%e, %namespace_name, "failed to delete namespace"); - Status::internal(e.to_string()) - } - })?; - - Ok(Response::new(DeleteNamespaceResponse {})) + warn!("call to namespace delete - unimplemented"); + Err(Status::unimplemented( + "namespace delete is not yet supported", + )) } async fn update_namespace_retention(