mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-26 09:50:40 +00:00
feat: handle drop request for metric table (#3136)
* handle drop request Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * adjust procedure manager Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * add create table sqlness test Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * insert/query metric table Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * address CR comments Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * Update src/common/meta/src/kv_backend.rs Co-authored-by: JeremyHi <jiachun_feng@proton.me> * fix clippy Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * reuse region option for metadata region Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * tweak variable name Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: JeremyHi <jiachun_feng@proton.me>
This commit is contained in:
@@ -389,15 +389,21 @@ async fn handle_drop_table_task(
|
||||
let table_metadata_manager = &ddl_manager.table_metadata_manager();
|
||||
let table_ref = drop_table_task.table_ref();
|
||||
|
||||
let (table_info_value, table_route_value) =
|
||||
table_metadata_manager.get_full_table_info(table_id).await?;
|
||||
let table_info_value = table_metadata_manager
|
||||
.table_info_manager()
|
||||
.get(table_id)
|
||||
.await?;
|
||||
let (_, table_route_value) = table_metadata_manager
|
||||
.table_route_manager()
|
||||
.get_physical_table_route(table_id)
|
||||
.await?;
|
||||
|
||||
let table_info_value = table_info_value.with_context(|| error::TableInfoNotFoundSnafu {
|
||||
table_name: table_ref.to_string(),
|
||||
})?;
|
||||
|
||||
let table_route_value =
|
||||
table_route_value.context(error::TableRouteNotFoundSnafu { table_id })?;
|
||||
DeserializedValueWithBytes::from_inner(TableRouteValue::Physical(table_route_value));
|
||||
|
||||
let id = ddl_manager
|
||||
.submit_drop_table_task(
|
||||
|
||||
@@ -354,6 +354,7 @@ impl TableMetadataManager {
|
||||
&self.kv_backend
|
||||
}
|
||||
|
||||
// TODO(ruihang): deprecate this
|
||||
pub async fn get_full_table_info(
|
||||
&self,
|
||||
table_id: TableId,
|
||||
|
||||
@@ -114,6 +114,7 @@ where
|
||||
Ok(!resp.kvs.is_empty())
|
||||
}
|
||||
|
||||
/// Returns previous key-value pair if `prev_kv` is `true`.
|
||||
async fn delete(&self, key: &[u8], prev_kv: bool) -> Result<Option<KeyValue>, Self::Error> {
|
||||
let mut req = DeleteRangeRequest::new().with_key(key.to_vec());
|
||||
if prev_kv {
|
||||
|
||||
Reference in New Issue
Block a user