From 5466b61ba71acd20e03af159d82f04d3de395b89 Mon Sep 17 00:00:00 2001 From: Jiacai Liu Date: Thu, 11 May 2023 18:12:25 +0800 Subject: [PATCH] chore: remove garbage create table log (#890) --- integration_tests/build_meta.sh | 7 +++++-- .../cases/env/cluster/ddl/create_tables.result | 8 ++++---- meta_client/src/types.rs | 18 ++++++++++++++++-- proxy/src/http/prom.rs | 2 +- proxy/src/influxdb/types.rs | 2 +- server/src/config.rs | 6 ++---- server/src/http.rs | 2 -- server/src/server.rs | 2 +- 8 files changed, 30 insertions(+), 17 deletions(-) mode change 100644 => 100755 integration_tests/build_meta.sh diff --git a/integration_tests/build_meta.sh b/integration_tests/build_meta.sh old mode 100644 new mode 100755 index 8e37eb466e..1558833a11 --- a/integration_tests/build_meta.sh +++ b/integration_tests/build_meta.sh @@ -2,8 +2,11 @@ set -exo -if [ ! -d ceresmeta ]; then - git clone --depth 1 https://github.com/ceresdb/ceresmeta.git +if [ -d ceresmeta ]; then + echo "Remove old meta..." + rm -r ceresmeta fi + +git clone --depth 1 https://github.com/ceresdb/ceresmeta.git cd ceresmeta go build -o ceresmeta ./cmd/meta/... diff --git a/integration_tests/cases/env/cluster/ddl/create_tables.result b/integration_tests/cases/env/cluster/ddl/create_tables.result index 6466de9f5c..946b6262f0 100644 --- a/integration_tests/cases/env/cluster/ddl/create_tables.result +++ b/integration_tests/cases/env/cluster/ddl/create_tables.result @@ -44,11 +44,11 @@ affected_rows: 0 CREATE TABLE IF NOT EXISTS `05_create_tables_t`(c1 int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic; -Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: CREATE TABLE IF NOT EXISTS `05_create_tables_t`(c1 int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t\", encoded_schema: [0, 10, 10, 10, 4, 116, 115, 105, 100, 16, 5, 32, 1, 10, 7, 10, 1, 116, 16, 1, 32, 2, 10, 10, 10, 2, 99, 49, 16, 8, 24, 1, 32, 3, 16, 1, 24, 2, 34, 2, 1, 2], engine: \"Analytic\", create_if_not_exist: true, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) +Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: CREATE TABLE IF NOT EXISTS `05_create_tables_t`(c1 int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t\", engine: \"Analytic\", create_if_not_exist: true, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) CREATE TABLE `05_create_tables_t`(c1 int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic; -Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: CREATE TABLE `05_create_tables_t`(c1 int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t\", encoded_schema: [0, 10, 10, 10, 4, 116, 115, 105, 100, 16, 5, 32, 1, 10, 7, 10, 1, 116, 16, 1, 32, 2, 10, 10, 10, 2, 99, 49, 16, 8, 24, 1, 32, 3, 16, 1, 24, 2, 34, 2, 1, 2], engine: \"Analytic\", create_if_not_exist: false, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) +Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: CREATE TABLE `05_create_tables_t`(c1 int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t\", engine: \"Analytic\", create_if_not_exist: false, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) create table `05_create_tables_t2`(a int, b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic with (enable_ttl='false'); @@ -67,11 +67,11 @@ Int32(4), create table `05_create_tables_t2`(a int,b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic; -Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: create table `05_create_tables_t2`(a int,b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t2\", encoded_schema: [0, 10, 10, 10, 4, 116, 115, 105, 100, 16, 5, 32, 1, 10, 7, 10, 1, 116, 16, 1, 32, 2, 10, 9, 10, 1, 97, 16, 8, 24, 1, 32, 3, 10, 9, 10, 1, 98, 16, 8, 24, 1, 32, 4, 16, 1, 24, 2, 34, 2, 1, 2], engine: \"Analytic\", create_if_not_exist: false, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) +Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: create table `05_create_tables_t2`(a int,b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t2\", engine: \"Analytic\", create_if_not_exist: false, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) create table `05_create_tables_t2`(a int,b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic; -Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: create table `05_create_tables_t2`(a int,b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t2\", encoded_schema: [0, 10, 10, 10, 4, 116, 115, 105, 100, 16, 5, 32, 1, 10, 7, 10, 1, 116, 16, 1, 32, 2, 10, 9, 10, 1, 97, 16, 8, 24, 1, 32, 3, 10, 9, 10, 1, 98, 16, 8, 24, 1, 32, 4, 16, 1, 24, 2, 34, 2, 1, 2], engine: \"Analytic\", create_if_not_exist: false, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) +Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to execute interpreter, sql: create table `05_create_tables_t2`(a int,b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic;. Caused by: Failed to execute create table, err:Failed to create table by table manipulator, err:Failed to create table, msg:failed to create table by meta client, req:CreateTableRequest { schema_name: \"public\", name: \"05_create_tables_t2\", engine: \"Analytic\", create_if_not_exist: false, options: {}, partition_table_info: None }, err:Missing table info, msg:created table is not found in the create table response." }) create table `05_create_tables_t3`(a int,b int, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE = Analytic; diff --git a/meta_client/src/types.rs b/meta_client/src/types.rs index 8e1dc76278..8bf9bf92f8 100644 --- a/meta_client/src/types.rs +++ b/meta_client/src/types.rs @@ -1,6 +1,6 @@ // Copyright 2022-2023 CeresDB Project Authors. Licensed under Apache-2.0. -use std::{collections::HashMap, sync::Arc}; +use std::{collections::HashMap, fmt, sync::Arc}; use ceresdbproto::{cluster as cluster_pb, meta_service as meta_service_pb}; pub use common_types::table::{ShardId, ShardVersion}; @@ -39,7 +39,7 @@ pub struct PartitionTableInfo { pub partition_info: PartitionInfo, } -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct CreateTableRequest { pub schema_name: String, pub name: String, @@ -50,6 +50,20 @@ pub struct CreateTableRequest { pub partition_table_info: Option, } +impl fmt::Debug for CreateTableRequest { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + // ignore encoded_schema + f.debug_struct("CreateTableRequest") + .field("schema_name", &self.schema_name) + .field("name", &self.name) + .field("engine", &self.engine) + .field("create_if_not_exist", &self.create_if_not_exist) + .field("options", &self.options) + .field("partition_table_info", &self.partition_table_info) + .finish() + } +} + #[derive(Clone, Debug)] pub struct CreateTableResponse { pub created_table: TableInfo, diff --git a/proxy/src/http/prom.rs b/proxy/src/http/prom.rs index a27e0010c9..1c4e771e44 100644 --- a/proxy/src/http/prom.rs +++ b/proxy/src/http/prom.rs @@ -407,7 +407,7 @@ fn convert_write_request(req: WriteRequest) -> Result> { .unzip(); req_by_metric - // fields with same tag names will be grouped together + // Fields with same tag names will be grouped together. .entry((metric.clone(), tag_names.clone())) .or_insert_with(|| WriteTableRequest { table: metric, diff --git a/proxy/src/influxdb/types.rs b/proxy/src/influxdb/types.rs index 2280e4a11d..1ec38e825f 100644 --- a/proxy/src/influxdb/types.rs +++ b/proxy/src/influxdb/types.rs @@ -496,7 +496,7 @@ pub(crate) fn convert_write_request(req: WriteRequest) -> Result>(); let req_for_one_measurement = req_by_measurement - // fields with same tag names will be grouped together + // Fields with same tag names will be grouped together. .entry((line.series.measurement.to_string(), tag_names.clone())) .or_insert_with(|| WriteTableRequest { table: line.series.measurement.to_string(), diff --git a/server/src/config.rs b/server/src/config.rs index 3749264e6c..9233dd50cd 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -16,8 +16,6 @@ use router::{ use serde::{Deserialize, Serialize}; use table_engine::ANALYTIC_ENGINE_TYPE; -use crate::http::DEFAULT_MAX_BODY_SIZE; - #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[serde(default)] pub struct StaticRouteConfig { @@ -100,7 +98,7 @@ pub struct ServerConfig { pub grpc_port: u16, pub timeout: Option, - pub http_max_body_size: u64, + pub http_max_body_size: ReadableSize, pub grpc_server_cq_count: usize, /// The minimum length of the response body to compress. pub resp_compress_min_length: ReadableSize, @@ -129,7 +127,7 @@ impl Default for ServerConfig { mysql_port: 3307, grpc_port: 8831, timeout: None, - http_max_body_size: DEFAULT_MAX_BODY_SIZE, + http_max_body_size: ReadableSize::mb(64), grpc_server_cq_count: 20, resp_compress_min_length: ReadableSize::mb(4), forward: forward::Config::default(), diff --git a/server/src/http.rs b/server/src/http.rs index 091b7f6f9c..623662c9ad 100644 --- a/server/src/http.rs +++ b/server/src/http.rs @@ -114,8 +114,6 @@ define_result!(Error); impl reject::Reject for Error {} -pub const DEFAULT_MAX_BODY_SIZE: u64 = 64 * 1024; - /// Http service /// /// Endpoints beginning with /debug are for internal use, and may subject to diff --git a/server/src/server.rs b/server/src/server.rs index 2712df3d9d..c53b40142a 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -350,7 +350,7 @@ impl Builder { let http_config = HttpConfig { endpoint: http_endpoint, - max_body_size: self.server_config.http_max_body_size, + max_body_size: self.server_config.http_max_body_size.as_byte(), timeout: self.server_config.timeout.map(|v| v.0), };