mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-30 15:36:59 +00:00
refactor!: remove the tableid in ddl response since tableids is enough (#4080)
* refactor: remove the tableid in ddl response since tableids is enough * chore: upgrade proto
This commit is contained in:
Generated
+1
-1
@@ -4188,7 +4188,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
[[package]]
|
||||
name = "greptime-proto"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/killme2008/greptime-proto.git?rev=a15a54a714fe117d7e9f7635e149c4eecac773fa#a15a54a714fe117d7e9f7635e149c4eecac773fa"
|
||||
source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=ae26136accd82fbdf8be540cd502f2e94951077e#ae26136accd82fbdf8be540cd502f2e94951077e"
|
||||
dependencies = [
|
||||
"prost 0.12.4",
|
||||
"serde",
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ etcd-client = { git = "https://github.com/MichaelScofield/etcd-client.git", rev
|
||||
fst = "0.4.7"
|
||||
futures = "0.3"
|
||||
futures-util = "0.3"
|
||||
greptime-proto = { git = "https://github.com/killme2008/greptime-proto.git", rev = "a15a54a714fe117d7e9f7635e149c4eecac773fa" }
|
||||
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "ae26136accd82fbdf8be540cd502f2e94951077e" }
|
||||
humantime = "2.1"
|
||||
humantime-serde = "1.1"
|
||||
itertools = "0.10"
|
||||
|
||||
@@ -489,8 +489,7 @@ async fn handle_create_table_task(
|
||||
|
||||
Ok(SubmitDdlTaskResponse {
|
||||
key: procedure_id.into(),
|
||||
table_id: Some(table_id),
|
||||
..Default::default()
|
||||
table_ids: vec![table_id],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -534,7 +533,6 @@ async fn handle_create_logical_table_tasks(
|
||||
Ok(SubmitDdlTaskResponse {
|
||||
key: procedure_id.into(),
|
||||
table_ids,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -690,8 +688,7 @@ async fn handle_create_view_task(
|
||||
|
||||
Ok(SubmitDdlTaskResponse {
|
||||
key: procedure_id.into(),
|
||||
table_id: Some(view_id),
|
||||
..Default::default()
|
||||
table_ids: vec![view_id],
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -274,10 +274,7 @@ impl TryFrom<SubmitDdlTaskRequest> for PbDdlTaskRequest {
|
||||
#[derive(Debug, Default)]
|
||||
pub struct SubmitDdlTaskResponse {
|
||||
pub key: Vec<u8>,
|
||||
// For create physical table
|
||||
// TODO(jeremy): remove it?
|
||||
pub table_id: Option<TableId>,
|
||||
// For create multi logical tables
|
||||
// `table_id`s for `CREATE TABLE` or `CREATE LOGICAL TABLES` task.
|
||||
pub table_ids: Vec<TableId>,
|
||||
}
|
||||
|
||||
@@ -285,11 +282,9 @@ impl TryFrom<PbDdlTaskResponse> for SubmitDdlTaskResponse {
|
||||
type Error = error::Error;
|
||||
|
||||
fn try_from(resp: PbDdlTaskResponse) -> Result<Self> {
|
||||
let table_id = resp.table_id.map(|t| t.id);
|
||||
let table_ids = resp.table_ids.into_iter().map(|t| t.id).collect();
|
||||
Ok(Self {
|
||||
key: resp.pid.map(|pid| pid.key).unwrap_or_default(),
|
||||
table_id,
|
||||
table_ids,
|
||||
})
|
||||
}
|
||||
@@ -299,9 +294,6 @@ impl From<SubmitDdlTaskResponse> for PbDdlTaskResponse {
|
||||
fn from(val: SubmitDdlTaskResponse) -> Self {
|
||||
Self {
|
||||
pid: Some(ProcedureId { key: val.key }),
|
||||
table_id: val
|
||||
.table_id
|
||||
.map(|table_id| api::v1::TableId { id: table_id }),
|
||||
table_ids: val
|
||||
.table_ids
|
||||
.into_iter()
|
||||
|
||||
@@ -238,9 +238,13 @@ impl StatementExecutor {
|
||||
)
|
||||
.await?;
|
||||
|
||||
let table_id = resp.table_id.context(error::UnexpectedSnafu {
|
||||
violated: "expected table_id",
|
||||
})?;
|
||||
let table_id = resp
|
||||
.table_ids
|
||||
.into_iter()
|
||||
.next()
|
||||
.context(error::UnexpectedSnafu {
|
||||
violated: "expected table_id",
|
||||
})?;
|
||||
info!("Successfully created table '{table_name}' with table id {table_id}");
|
||||
|
||||
table_info.ident.table_id = table_id;
|
||||
@@ -531,9 +535,13 @@ impl StatementExecutor {
|
||||
resp
|
||||
);
|
||||
|
||||
let view_id = resp.table_id.context(error::UnexpectedSnafu {
|
||||
violated: "expected table_id",
|
||||
})?;
|
||||
let view_id = resp
|
||||
.table_ids
|
||||
.into_iter()
|
||||
.next()
|
||||
.context(error::UnexpectedSnafu {
|
||||
violated: "expected table_id",
|
||||
})?;
|
||||
info!("Successfully created view '{view_name}' with view id {view_id}");
|
||||
|
||||
// Invalidates local cache ASAP.
|
||||
|
||||
Reference in New Issue
Block a user