Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove garbage create table logs #890

Merged
merged 2 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions integration_tests/build_meta.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
8 changes: 4 additions & 4 deletions integration_tests/cases/env/cluster/ddl/create_tables.result
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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;

Expand Down
18 changes: 16 additions & 2 deletions meta_client/src/types.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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,
Expand All @@ -50,6 +50,20 @@ pub struct CreateTableRequest {
pub partition_table_info: Option<PartitionTableInfo>,
}

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,
Expand Down
2 changes: 1 addition & 1 deletion proxy/src/http/prom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ fn convert_write_request(req: WriteRequest) -> Result<Vec<WriteTableRequest>> {
.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,
Expand Down
2 changes: 1 addition & 1 deletion proxy/src/influxdb/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ pub(crate) fn convert_write_request(req: WriteRequest) -> Result<Vec<WriteTableR
.map(|(tagk, _)| tagk.to_string())
.collect::<Vec<_>>();
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(),
Expand Down
6 changes: 2 additions & 4 deletions server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -100,7 +98,7 @@ pub struct ServerConfig {
pub grpc_port: u16,

pub timeout: Option<ReadableDuration>,
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,
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 0 additions & 2 deletions server/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl<Q: QueryExecutor + 'static> Builder<Q> {

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(),
chunshao90 marked this conversation as resolved.
Show resolved Hide resolved
timeout: self.server_config.timeout.map(|v| v.0),
};

Expand Down