Skip to content

Commit

Permalink
chore: add logs for drop database
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Nov 5, 2024
1 parent ac387bd commit 8dcf48f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/common/meta/src/ddl/drop_database/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::any::Any;

use common_catalog::format_full_table_name;
use common_procedure::Status;
use common_telemetry::info;
use futures::TryStreamExt;
use serde::{Deserialize, Serialize};
use snafu::OptionExt;
Expand Down Expand Up @@ -72,7 +73,7 @@ impl DropDatabaseCursor {
match (self.target, table_route_value) {
(DropTableTarget::Logical, TableRouteValue::Logical(route)) => {
let physical_table_id = route.physical_table_id();

info!("Drop database: fetching physical table route for drop database");
let (_, table_route) = ddl_ctx
.table_metadata_manager
.table_route_manager()
Expand Down Expand Up @@ -150,6 +151,7 @@ impl State for DropDatabaseCursor {
ctx: &mut DropDatabaseContext,
) -> Result<(Box<dyn State>, Status)> {
if ctx.tables.as_deref().is_none() {
info!("Drop database: fetching tables for drop database");
let tables = ddl_ctx
.table_metadata_manager
.table_name_manager()
Expand All @@ -161,6 +163,7 @@ impl State for DropDatabaseCursor {
Some((table_name, table_name_value)) => {
let table_id = table_name_value.table_id();

info!("Drop database: fetching table info for drop database");
let table_info_value = ddl_ctx
.table_metadata_manager
.table_info_manager()
Expand Down
2 changes: 2 additions & 0 deletions src/common/meta/src/ddl/drop_database/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ impl State for DropDatabaseExecutor {
ctx: &mut DropDatabaseContext,
) -> Result<(Box<dyn State>, Status)> {
self.register_dropping_regions(ddl_ctx)?;
info!("Drop database: drop table metadata: {}", self.table_name);
let executor =
DropTableExecutor::new(ctx.cluster_id, self.table_name.clone(), self.table_id, true);
// Deletes metadata for table permanently.
Expand All @@ -111,6 +112,7 @@ impl State for DropDatabaseExecutor {
.on_destroy_metadata(ddl_ctx, &table_route_value)
.await?;
executor.invalidate_table_cache(ddl_ctx).await?;
info!("Drop database: drop regions: {}", self.table_name);
executor
.on_drop_regions(ddl_ctx, &self.physical_region_routes)
.await?;
Expand Down

0 comments on commit 8dcf48f

Please sign in to comment.