Skip to content

Commit

Permalink
chore: apply suggestions from CR
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Aug 8, 2024
1 parent 24e0ac9 commit d8c8e66
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions src/common/meta/src/ddl/drop_table/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use common_catalog::format_full_table_name;
use snafu::OptionExt;
use store_api::metric_engine_consts::{LOGICAL_TABLE_METADATA_KEY, METRIC_ENGINE_NAME};
use store_api::metric_engine_consts::METRIC_ENGINE_NAME;

use crate::ddl::drop_table::DropTableProcedure;
use crate::error::{self, Result};
Expand All @@ -33,26 +33,21 @@ impl DropTableProcedure {
self.data.physical_region_routes = physical_table_route_value.region_routes;
self.data.physical_table_id = Some(physical_table_id);

let table_info_value = self
.context
.table_metadata_manager
.table_info_manager()
.get(task.table_id)
.await?
.with_context(|| error::TableInfoNotFoundSnafu {
table: format_full_table_name(&task.catalog, &task.schema, &task.table),
})?
.into_inner();
if physical_table_id == self.data.table_id() {
let table_info_value = self
.context
.table_metadata_manager
.table_info_manager()
.get(task.table_id)
.await?
.with_context(|| error::TableInfoNotFoundSnafu {
table: format_full_table_name(&task.catalog, &task.schema, &task.table),
})?
.into_inner();

let engine = table_info_value.table_info.meta.engine;
if engine.as_str() == METRIC_ENGINE_NAME {
let physical = !table_info_value
.table_info
.meta
.options
.extra_options
.contains_key(LOGICAL_TABLE_METADATA_KEY);
self.data.allow_rollback = physical;
let engine = table_info_value.table_info.meta.engine;
// rollback only if dropping the metric physical table fails
self.data.allow_rollback = engine.as_str() == METRIC_ENGINE_NAME
}

Ok(())
Expand Down

0 comments on commit d8c8e66

Please sign in to comment.