From 7ffdbc8f41582b95cbdbe5553090a6e88b96125a Mon Sep 17 00:00:00 2001 From: kongkong Date: Fri, 26 Jul 2024 15:31:48 +0800 Subject: [PATCH 1/3] rm console --- agent/src/console.rs | 30 -------------- agent/src/init.rs | 2 - agent/src/main.rs | 1 - tests_integration/src/all.rs | 1 - tests_integration/src/api.rs | 76 ------------------------------------ 5 files changed, 110 deletions(-) delete mode 100644 agent/src/console.rs delete mode 100644 tests_integration/src/api.rs diff --git a/agent/src/console.rs b/agent/src/console.rs deleted file mode 100644 index 40bfaa266..000000000 --- a/agent/src/console.rs +++ /dev/null @@ -1,30 +0,0 @@ -// 必须运行在tokio的runtime环境中 -#[cfg(feature = "console-api")] -pub(super) fn start_console(ctx: &context::Context) { - log::error!("you should start console-api, this feature not supported now"); - return; - use rocket::{ - config::{Config, Sig}, - log::LogLevel, - }; - use std::net::Ipv4Addr; - log::info!("starting console http server!"); - let mut c = Config::default(); - c.shutdown.ctrlc = false; - c.shutdown.signals.insert(Sig::Hup); - c.address = Ipv4Addr::new(0, 0, 0, 0).into(); - c.port = ctx.port; - c.log_level = LogLevel::Critical; - c.workers = 4; - let rocket = rocket::custom(c); - - rt::spawn(api::start_whitelist_refresh(ctx.whitelist_host.clone())); - let rocket = api::routes(rocket); - - //rocket = rocket.attach(rocket_async_compression::Compression::fairing()); - rt::spawn(async { - if let Err(_e) = rocket.launch().await { - log::error!("launch rocket failed: {:?}", _e); - }; - }); -} diff --git a/agent/src/init.rs b/agent/src/init.rs index 8a9aeb9d2..8e89462c5 100644 --- a/agent/src/init.rs +++ b/agent/src/init.rs @@ -7,8 +7,6 @@ pub(super) fn init(ctx: &Context) { init_log(&ctx); init_local_ip(&ctx); start_metrics_register_task(ctx); - #[cfg(feature = "console-api")] - crate::console::start_console(ctx); #[cfg(feature = "http")] crate::http::start(ctx); diff --git a/agent/src/main.rs b/agent/src/main.rs index 22c46bc39..01a82acd1 100644 --- a/agent/src/main.rs +++ b/agent/src/main.rs @@ -2,7 +2,6 @@ use ds::BrzMalloc; #[global_allocator] static GLOBAL: BrzMalloc = BrzMalloc {}; -mod console; mod http; mod prometheus; mod service; diff --git a/tests_integration/src/all.rs b/tests_integration/src/all.rs index d1be04dc8..48a590bb3 100644 --- a/tests_integration/src/all.rs +++ b/tests_integration/src/all.rs @@ -1,4 +1,3 @@ -mod api; mod ci; mod counterservice; // mod hasher; diff --git a/tests_integration/src/api.rs b/tests_integration/src/api.rs deleted file mode 100644 index 9777657a5..000000000 --- a/tests_integration/src/api.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! get /meta/snapshot -//! get /meta/sockfile -//! get /meta - -#![allow(unused)] - -use reqwest::blocking; -use serde::Deserialize; -// use std::collections::HashMap; - -/// mete接口返回的数据:{"sock_path":"/home/thl/breezed/socks","snapshot_path":"/home/thl/breezed/snapshot","version":"gc49e797c_debug_vx","sockfiles":[...]} -/// 只测试sockfiles字段 -/// 如果新增了socks,此处测试需要增加 -/// 本地不要测试此用例 -#[cfg(feature = "console-api")] -#[test] -fn meta() -> Result<(), Box> { - #[derive(Deserialize)] - struct Resp { - sockfiles: Vec, - } - let mut resp: Resp = blocking::get("http://localhost:9984/breeze/meta")?.json()?; - assert_eq!( - resp.sockfiles.sort(), - vec![ - "config+cloud+counterservice+testbreeze+meshtest@redis:9302@rs", - "config+cloud+phantom+testbreeze+phantomtest@phantom:9303@pt", - "config+cloud+redis+testbreeze+redismeshtest@redis:56810@rs", - "config+cloud+redis+testbreeze+redismeshtestm@redis:56812@rs", - "config+v1+cache.service.testbreeze.pool.yf+all:meshtest@mc:9301@cs" - ] - .sort() - ); - Ok(()) -} - -#[cfg(feature = "console-api")] -#[test] -fn sockfile() -> Result<(), Box> { - #[derive(Deserialize)] - struct Sock { - name: String, - content: String, - } - - let mut url = reqwest::Url::parse("http://localhost:9984/breeze/meta/sockfile")?; - url.query_pairs_mut() - .append_pair("service", "config+cloud+redis+testbreeze+redismeshtest"); - - let mut resp: Vec = blocking::get(url)?.json()?; - assert_eq!( - resp[0].name, - "config+cloud+redis+testbreeze+redismeshtest@redis:56810@rs" - ); - Ok(()) -} - -// [{"name":"config+cloud+redis+testbreeze+redismeshtest","content":"FEgxAiVeCKxCmDCwTJ5xXQ 1669094903147435679\nbackends:\n- 10.182.27.228:56378,10.182.27.228:56378\n- 10.182.27.228:56379,10.182.27.228:56379\n- 10.182.27.228:56380,10.182.27.228:56380\n- 10.182.27.228:56381,10.182.27.228:56381\nbasic:\n access_mod: rw\n distribution: modula\n hash: crc32local\n listen: 56378,56379,56380,56381\n resource_type: eredis\n timeout_ms_master: 0\n timeout_ms_slave: 0\n"}] -#[cfg(feature = "console-api")] -#[test] -fn snapshot() -> Result<(), Box> { - #[derive(Deserialize)] - struct Sock { - name: String, - content: String, - } - - let mut url = reqwest::Url::parse("http://localhost:9984/breeze/meta/snapshot")?; - url.query_pairs_mut() - .append_pair("service", "config+cloud+redis+testbreeze+redismeshtest"); - - let mut resp: Vec = blocking::get(url)?.json()?; - assert_eq!(resp[0].name, "config+cloud+redis+testbreeze+redismeshtest"); - assert!(resp[0].content.contains("backends")); - Ok(()) -} From c848b85c533bfdb73db8d94e854ce77b464a80d8 Mon Sep 17 00:00:00 2001 From: kongkong Date: Fri, 26 Jul 2024 15:40:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocol/src/vector/query_result.rs | 7 +------ stream/Cargo.toml | 3 +++ tests/src/all.rs | 1 - tests/src/time.rs | 3 --- 4 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 tests/src/time.rs diff --git a/protocol/src/vector/query_result.rs b/protocol/src/vector/query_result.rs index 0af14a776..0b00872c8 100644 --- a/protocol/src/vector/query_result.rs +++ b/protocol/src/vector/query_result.rs @@ -7,7 +7,7 @@ pub use crate::kv::common::proto::Text; use super::packet::MysqlRawPacket; use crate::kv::common::{io::ParseBuf, packets::OkPacket, row::RowDeserializer}; -use std::{marker::PhantomData, sync::Arc}; +use std::marker::PhantomData; use crate::kv::common::packets::{Column, OldEofPacket, ResultSetTerminator}; use crate::kv::common::query_result::{Or, SetIteratorState}; @@ -181,11 +181,6 @@ impl QueryResult { } } -#[derive(Debug, Clone, PartialEq)] -pub struct SetColumns<'a> { - inner: Option<&'a Arc<[Column]>>, -} - #[inline] pub fn format_to_redis(rows: &Vec) -> Vec { let mut data = Vec::with_capacity(32 * rows.len()); diff --git a/stream/Cargo.toml b/stream/Cargo.toml index 74cab0ae9..7fc9b67e4 100644 --- a/stream/Cargo.toml +++ b/stream/Cargo.toml @@ -22,3 +22,6 @@ array-init = "2" ctor = "0.1.23" tokio.workspace = true + +[features] +trace = [] diff --git a/tests/src/all.rs b/tests/src/all.rs index 683da03a2..e679c18da 100644 --- a/tests/src/all.rs +++ b/tests/src/all.rs @@ -32,5 +32,4 @@ mod proto_hook; mod ring_buffer; mod select; mod shard_checker; -mod time; mod tx_buffer; diff --git a/tests/src/time.rs b/tests/src/time.rs deleted file mode 100644 index f086883fb..000000000 --- a/tests/src/time.rs +++ /dev/null @@ -1,3 +0,0 @@ -#[cfg(feature = "tsc")] -#[test] -fn check_tsc() {} From 088da580505425ace5c50f7b87f81a7a3543415b Mon Sep 17 00:00:00 2001 From: hustfisher Date: Fri, 26 Jul 2024 17:19:17 +0800 Subject: [PATCH 3/3] update features to avoid warnings --- protocol/Cargo.toml | 15 +++++++++++++++ protocol/src/kv/common/misc/raw/seq.rs | 1 + protocol/src/kv/common/packets/binlog_request.rs | 1 + protocol/src/kv/common/packets/mod.rs | 2 ++ protocol/src/kv/common/query_result.rs | 1 + tests/Cargo.toml | 6 ++++-- 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 3b6e5e27d..df7a9b676 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -47,6 +47,21 @@ paste = "1.0" [features] max_allowed_packet = [] regex = ["dep:regex"] +buffer-pool = [] +bigdecimal = [] +bigdecimal03 = [] +chrono = [] +rust_decimal = [] +time = [] +time03 = [] +uuid = [] +rustc_serialize = [] +native-tls = [] +rustls = [] +frunk = [] +nightly = [] +rustls-tls = [] + [dev-dependencies] proptest = "1.0" diff --git a/protocol/src/kv/common/misc/raw/seq.rs b/protocol/src/kv/common/misc/raw/seq.rs index 6d54fae77..411a77f59 100644 --- a/protocol/src/kv/common/misc/raw/seq.rs +++ b/protocol/src/kv/common/misc/raw/seq.rs @@ -101,6 +101,7 @@ where } /// Representation of a serialized bytes. +#[allow(dead_code)] pub trait SeqRepr { /// Maximum number of items in a sequence (depends on how lenght is stored). const MAX_LEN: usize; diff --git a/protocol/src/kv/common/packets/binlog_request.rs b/protocol/src/kv/common/packets/binlog_request.rs index dbf30f6cb..f8b444790 100644 --- a/protocol/src/kv/common/packets/binlog_request.rs +++ b/protocol/src/kv/common/packets/binlog_request.rs @@ -13,6 +13,7 @@ use super::{BinlogDumpFlags, Sid}; /// Binlog request representation. Please consult MySql documentation. /// /// This struct is a helper builder for [`ComBinlogDump`] and [`ComBinlogDumpGtid`]. +#[allow(dead_code)] #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct BinlogRequest<'a> { /// Server id of a slave. diff --git a/protocol/src/kv/common/packets/mod.rs b/protocol/src/kv/common/packets/mod.rs index bc0699e6e..c818c653b 100644 --- a/protocol/src/kv/common/packets/mod.rs +++ b/protocol/src/kv/common/packets/mod.rs @@ -2259,6 +2259,7 @@ define_const!( 1 ); +#[allow(dead_code)] #[derive(Debug, Clone, PartialEq)] pub struct ComStmtExecuteRequest<'a> { com_stmt_execute: ComStmtExecuteHeader, @@ -2365,6 +2366,7 @@ define_header!( InvalidComStmtSendLongDataHeader ); +#[allow(dead_code)] #[derive(Debug, Clone, Eq, PartialEq)] pub struct ComStmtSendLongData { __header: ComStmtSendLongDataHeader, diff --git a/protocol/src/kv/common/query_result.rs b/protocol/src/kv/common/query_result.rs index 14930cb76..199cc24eb 100644 --- a/protocol/src/kv/common/query_result.rs +++ b/protocol/src/kv/common/query_result.rs @@ -491,6 +491,7 @@ impl Drop for ResultSet<'_, '_, T, S } } +#[allow(dead_code)] #[derive(Debug, Clone, PartialEq)] pub struct SetColumns<'a> { inner: Option<&'a Arc<[Column]>>, diff --git a/tests/Cargo.toml b/tests/Cargo.toml index cdc2f1544..2f332d4f4 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -17,13 +17,13 @@ rand = "0.8.5" md5 = "*" byteorder = "1.4.3" assert-panic = "1.0.1" -metrics = { path = "../metrics", features = ["mock-local-ip"]} +metrics = { path = "../metrics", features = ["mock-local-ip"] } endpoint = { path = "../endpoint" } context = { path = "../context" } tokio.workspace = true ctor = "0.1.23" -mysql_async ="0.31.3" +mysql_async = "0.31.3" chrono = "0.4" lazy_static = "*" @@ -54,3 +54,5 @@ layout-min = ["ds/tsc"] layout-max = ["rt/poll-io-metrics"] regex = ["protocol/regex"] github_workflow = [] +time = [] +nightly = []