diff --git a/cluster/src/shard_operator.rs b/cluster/src/shard_operator.rs index 129715b702..fab9a1add7 100644 --- a/cluster/src/shard_operator.rs +++ b/cluster/src/shard_operator.rs @@ -15,7 +15,6 @@ use snafu::ResultExt; use table_engine::{ engine::{TableEngineRef, TableState}, table::TableId, - ANALYTIC_ENGINE_TYPE, }; use crate::{ diff --git a/cluster/src/shard_set.rs b/cluster/src/shard_set.rs index a537964ffe..f1921900fb 100644 --- a/cluster/src/shard_set.rs +++ b/cluster/src/shard_set.rs @@ -13,8 +13,9 @@ use crate::{ Result, ShardVersionMismatch, TableAlreadyExists, TableNotFound, UpdateFrozenShard, }; -/// [ShardTablesCache] caches the information about tables and shards, and the -/// relationship between them is: one shard -> multiple tables. +/// Shard set +/// +/// Manage all shards opened on current node #[derive(Debug, Default, Clone)] pub struct ShardSet { inner: Arc>>, @@ -46,6 +47,9 @@ impl ShardSet { } } +/// Shard +/// +/// NOTICE: all write operations on a shard will be performed sequentially. pub struct Shard { pub data: ShardDataRef, pub operator: tokio::sync::Mutex, @@ -113,12 +117,6 @@ impl Shard { pub type ShardRef = Arc; -#[derive(Debug, Clone)] -pub struct TableWithShards { - pub table_info: TableInfo, - pub shard_infos: Vec, -} - #[derive(Debug, Clone)] pub struct UpdatedTableInfo { pub prev_version: u64, @@ -126,6 +124,7 @@ pub struct UpdatedTableInfo { pub table_info: TableInfo, } +/// Shard data #[derive(Debug)] pub struct ShardData { /// Shard info diff --git a/server/src/grpc/meta_event_service/mod.rs b/server/src/grpc/meta_event_service/mod.rs index f800d3f3d9..165f15b4c6 100644 --- a/server/src/grpc/meta_event_service/mod.rs +++ b/server/src/grpc/meta_event_service/mod.rs @@ -297,7 +297,7 @@ async fn do_open_shard(ctx: HandlerContext, shard_info: ShardInfo) -> Result<()> shard.open(open_ctx).await.box_err().context(ErrWithCause { code: StatusCode::Internal, - msg: "fail to open shard in cluster", + msg: "fail to open shard", }) } @@ -346,7 +346,7 @@ async fn do_close_shard(ctx: &HandlerContext, shard_id: ShardId) -> Result<()> { .box_err() .context(ErrWithCause { code: StatusCode::Internal, - msg: "fail to close shard in cluster", + msg: "fail to close shard", })?; // Remove the shard from the cluster topology after the shard is closed indeed. @@ -434,7 +434,7 @@ async fn handle_create_table_on_shard( .box_err() .context(ErrWithCause { code: StatusCode::Internal, - msg: "fail to create table on shard in cluster", + msg: "fail to create table on shard", }) } @@ -470,7 +470,7 @@ async fn handle_drop_table_on_shard( .box_err() .context(ErrWithCause { code: StatusCode::Internal, - msg: "fail to drop table on shard in cluster", + msg: "fail to drop table on shard", }) } @@ -503,7 +503,7 @@ async fn handle_open_table_on_shard( .box_err() .context(ErrWithCause { code: StatusCode::Internal, - msg: "fail to open table on shard in cluster", + msg: "fail to open table on shard", }) } @@ -537,7 +537,7 @@ async fn handle_close_table_on_shard( .box_err() .context(ErrWithCause { code: StatusCode::Internal, - msg: "fail to close table on shard in cluster", + msg: "fail to close table on shard", }) }