mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-30 20:00:36 +00:00
feat: switch to using create table procedure (#1861)
* feat: switch to using create table procedure * fix: add missing table_id and fix uncaught error * refactor: remove unused code and metrics * chore: apply suggestions from CR * chore: remove unused attributes * feat: add info log and metrics * fix: fix conflicts
This commit is contained in:
@@ -21,6 +21,7 @@ mod store;
|
||||
|
||||
use api::v1::meta::Role;
|
||||
use common_grpc::channel_manager::{ChannelConfig, ChannelManager};
|
||||
use common_meta::rpc::ddl::{SubmitDdlTaskRequest, SubmitDdlTaskResponse};
|
||||
use common_meta::rpc::lock::{LockRequest, LockResponse, UnlockRequest};
|
||||
use common_meta::rpc::router::{CreateRequest, DeleteRequest, RouteRequest, RouteResponse};
|
||||
use common_meta::rpc::store::{
|
||||
@@ -185,11 +186,14 @@ impl MetaClient {
|
||||
client.start(urls.clone()).await?;
|
||||
info!("Store client started");
|
||||
}
|
||||
|
||||
if let Some(client) = &mut self.lock {
|
||||
client.start(urls).await?;
|
||||
client.start(urls.clone()).await?;
|
||||
info!("Lock client started");
|
||||
}
|
||||
if let Some(client) = &mut self.ddl {
|
||||
client.start(urls).await?;
|
||||
info!("Ddl client started");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -348,6 +352,20 @@ impl MetaClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn submit_ddl_task(
|
||||
&self,
|
||||
req: SubmitDdlTaskRequest,
|
||||
) -> Result<SubmitDdlTaskResponse> {
|
||||
let res = self
|
||||
.ddl_client()?
|
||||
.submit_ddl_task(req.try_into().context(error::ConvertMetaRequestSnafu)?)
|
||||
.await?
|
||||
.try_into()
|
||||
.context(error::ConvertMetaResponseSnafu)?;
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn heartbeat_client(&self) -> Result<HeartbeatClient> {
|
||||
self.heartbeat.clone().context(error::NotStartedSnafu {
|
||||
@@ -376,6 +394,13 @@ impl MetaClient {
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ddl_client(&self) -> Result<DdlClient> {
|
||||
self.ddl
|
||||
.clone()
|
||||
.context(error::NotStartedSnafu { name: "ddl_client" })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn channel_config(&self) -> &ChannelConfig {
|
||||
self.channel_manager.config()
|
||||
|
||||
@@ -27,14 +27,10 @@ use crate::error;
|
||||
use crate::error::Result;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
// TODO(weny): removes this in following PRs.
|
||||
#[allow(unused)]
|
||||
pub struct Client {
|
||||
inner: Arc<RwLock<Inner>>,
|
||||
}
|
||||
|
||||
// TODO(weny): removes this in following PRs.
|
||||
#[allow(dead_code)]
|
||||
impl Client {
|
||||
pub fn new(id: Id, role: Role, channel_manager: ChannelManager) -> Self {
|
||||
let inner = Arc::new(RwLock::new(Inner {
|
||||
|
||||
Reference in New Issue
Block a user