chore: bump latest greptime-proto version (#1920)

This commit is contained in:
Lei, HUANG
2023-07-10 16:28:22 +08:00
committed by GitHub
parent 63173f63a1
commit 207d3d23a1
9 changed files with 29 additions and 31 deletions
Generated
+1 -1
View File
@@ -4112,7 +4112,7 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "greptime-proto"
version = "0.1.0"
source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=917ead6274b4dccbaf33c59a7360646ba2f285a9#917ead6274b4dccbaf33c59a7360646ba2f285a9"
source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=0f30b7fcbf950f0596f1159373947a21ff737216#0f30b7fcbf950f0596f1159373947a21ff737216"
dependencies = [
"prost",
"serde",
+1 -1
View File
@@ -74,7 +74,7 @@ datafusion-substrait = { git = "https://github.com/waynexia/arrow-datafusion.git
etcd-client = "0.11"
futures = "0.3"
futures-util = "0.3"
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "917ead6274b4dccbaf33c59a7360646ba2f285a9" }
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "0f30b7fcbf950f0596f1159373947a21ff737216" }
itertools = "0.10"
lazy_static = "1.4"
parquet = "40.0"
+1
View File
@@ -257,6 +257,7 @@ fn ddl_request_type(request: &DdlRequest) -> &'static str {
Some(Expr::DropTable(_)) => "ddl.drop_table",
Some(Expr::FlushTable(_)) => "ddl.flush_table",
None => "ddl.empty",
_ => unreachable!("https://github.com/GreptimeTeam/greptimedb/pull/1912"),
}
}
+13 -7
View File
@@ -21,7 +21,7 @@ use std::collections::HashMap;
use std::fmt::{Debug, Formatter};
use std::sync::Arc;
use api::v1::meta::{RegionStat, TableName};
use api::v1::meta::{RegionStat, TableIdent, TableName};
use common_telemetry::{info, warn};
use snafu::ResultExt;
use table::engine::{EngineContext, TableEngineRef};
@@ -226,19 +226,25 @@ pub async fn datanode_stat(catalog_manager: &CatalogManagerRef) -> (u64, Vec<Reg
for table_name in table_names {
let Ok(Some(table)) = catalog_manager.table(&catalog_name, &schema_name, &table_name).await else { continue };
let region_numbers = &table.table_info().meta.region_numbers;
let table_info = table.table_info();
let region_numbers = &table_info.meta.region_numbers;
region_number += region_numbers.len() as u64;
let engine = &table.table_info().meta.engine;
let engine = &table_info.meta.engine;
let table_id = table_info.ident.table_id;
match table.region_stats() {
Ok(stats) => {
let stats = stats.into_iter().map(|stat| RegionStat {
region_id: stat.region_id,
table_name: Some(TableName {
catalog_name: catalog_name.clone(),
schema_name: schema_name.clone(),
table_name: table_name.clone(),
table_ident: Some(TableIdent {
table_id,
table_name: Some(TableName {
catalog_name: catalog_name.clone(),
schema_name: schema_name.clone(),
table_name: table_name.clone(),
}),
engine: engine.clone(),
}),
approximate_bytes: stat.disk_usage_bytes as i64,
attrs: HashMap::from([("engine_name".to_owned(), engine.clone())]),
+4 -1
View File
@@ -15,7 +15,7 @@
use std::any::Any;
use std::sync::Arc;
use api::v1::ddl_request::Expr as DdlExpr;
use api::v1::ddl_request::{Expr as DdlExpr, Expr};
use api::v1::greptime_request::Request as GrpcRequest;
use api::v1::query_request::Query;
use api::v1::{CreateDatabaseExpr, DdlRequest, DeleteRequest, InsertRequests};
@@ -198,6 +198,9 @@ impl Instance {
DdlExpr::CreateDatabase(expr) => self.handle_create_database(expr, query_ctx).await,
DdlExpr::DropTable(expr) => self.handle_drop_table(expr).await,
DdlExpr::FlushTable(expr) => self.handle_flush_table(expr).await,
Expr::CompactTable(_) => {
unreachable!("https://github.com/GreptimeTeam/greptimedb/pull/1912")
}
}
}
}
+4 -1
View File
@@ -19,7 +19,7 @@ use std::sync::Arc;
use std::time::Duration;
use api::helper::ColumnDataTypeWrapper;
use api::v1::ddl_request::Expr as DdlExpr;
use api::v1::ddl_request::{Expr as DdlExpr, Expr};
use api::v1::greptime_request::Request;
use api::v1::{
column_def, AlterExpr, CreateDatabaseExpr, CreateTableExpr, DeleteRequest, DropTableExpr,
@@ -597,6 +597,9 @@ impl GrpcQueryHandler for DistInstance {
TableName::new(&expr.catalog_name, &expr.schema_name, &expr.table_name);
self.flush_table(table_name, expr.region_number).await
}
Expr::CompactTable(_) => {
unreachable!("https://github.com/GreptimeTeam/greptimedb/pull/1912")
}
}
}
}
-2
View File
@@ -260,7 +260,6 @@ mod tests {
cluster_id: 0,
id: 100,
addr: "127.0.0.1:3001".to_string(),
is_leader: true,
..Default::default()
};
let stat_val = StatValue { stats: vec![stat] }.try_into().unwrap();
@@ -280,7 +279,6 @@ mod tests {
assert_eq!(0, stat.cluster_id);
assert_eq!(100, stat.id);
assert_eq!("127.0.0.1:3001", stat.addr);
assert!(stat.is_leader);
}
#[test]
+5 -16
View File
@@ -24,8 +24,6 @@ pub struct Stat {
pub cluster_id: u64,
pub id: u64,
pub addr: String,
/// Leader node
pub is_leader: bool,
/// The read capacity units during this period
pub rcus: i64,
/// The write capacity units during this period
@@ -34,13 +32,6 @@ pub struct Stat {
pub table_num: i64,
/// How many regions on this node
pub region_num: Option<u64>,
pub cpu_usage: f64,
pub load: f64,
/// Read disk IO on this node
pub read_io_rate: f64,
/// Write disk IO on this node
pub write_io_rate: f64,
/// Region stats on this node
pub region_stats: Vec<RegionStat>,
// The node epoch is used to check whether the node has restarted or redeployed.
pub node_epoch: u64,
@@ -78,7 +69,6 @@ impl TryFrom<HeartbeatRequest> for Stat {
let HeartbeatRequest {
header,
peer,
is_leader,
node_stat,
region_stats,
node_epoch,
@@ -92,20 +82,16 @@ impl TryFrom<HeartbeatRequest> for Stat {
} else {
None
};
Ok(Self {
timestamp_millis: time_util::current_time_millis(),
cluster_id: header.cluster_id,
id: peer.id,
addr: peer.addr,
is_leader,
rcus: node_stat.rcus,
wcus: node_stat.wcus,
table_num: node_stat.table_num,
region_num,
cpu_usage: node_stat.cpu_usage,
load: node_stat.load,
read_io_rate: node_stat.read_io_rate,
write_io_rate: node_stat.write_io_rate,
region_stats: region_stats.into_iter().map(RegionStat::from).collect(),
node_epoch,
})
@@ -117,7 +103,10 @@ impl TryFrom<HeartbeatRequest> for Stat {
impl From<api::v1::meta::RegionStat> for RegionStat {
fn from(value: api::v1::meta::RegionStat) -> Self {
let table = value.table_name.as_ref();
let table = value
.table_ident
.as_ref()
.and_then(|t| t.table_name.as_ref());
Self {
id: value.region_id,
catalog: table.map_or("", |t| &t.catalog_name).to_string(),
-2
View File
@@ -278,7 +278,6 @@ mod tests {
let stat = Stat {
cluster_id: 0,
id: 101,
is_leader: false,
region_num: Some(100),
..Default::default()
};
@@ -294,7 +293,6 @@ mod tests {
let stat = stats.get(0).unwrap();
assert_eq!(0, stat.cluster_id);
assert_eq!(101, stat.id);
assert!(!stat.is_leader);
assert_eq!(Some(100), stat.region_num);
}