Skip to content

Commit

Permalink
chore: udapte Rust toolchain to 2024-10-19 (#4857)
Browse files Browse the repository at this point in the history
* update rust toolchain

* change toolchain to 2024-10-17

* fix: clippy

* fix: ut

* bump shadow-rs

* fix: use nightly-2024-10-19

* fix: clippy

* chore/udapte-toolchain-2024-10-17: Update DEV_BUILDER_IMAGE_TAG to 2024-10-19-a5c00e85-20241024184445 in Makefile
  • Loading branch information
v0y4g3r authored Oct 25, 2024
1 parent 8b307e4 commit e328c70
Show file tree
Hide file tree
Showing 94 changed files with 181 additions and 164 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ schemars = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["float_roundtrip"] }
serde_with = "3"
shadow-rs = "0.31"
shadow-rs = "0.35"
similar-asserts = "1.6.0"
smallvec = { version = "1", features = ["serde"] }
snafu = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CARGO_BUILD_OPTS := --locked
IMAGE_REGISTRY ?= docker.io
IMAGE_NAMESPACE ?= greptime
IMAGE_TAG ?= latest
DEV_BUILDER_IMAGE_TAG ?= 2024-06-06-5674c14f-20240920110415
DEV_BUILDER_IMAGE_TAG ?= 2024-10-19-a5c00e85-20241024184445
BUILDX_MULTI_PLATFORM_BUILD ?= false
BUILDX_BUILDER_NAME ?= gtbuilder
BASE_IMAGE ?= ubuntu
Expand Down
3 changes: 1 addition & 2 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[toolchain]
channel = "nightly-2024-06-06"

channel = "nightly-2024-10-19"
4 changes: 2 additions & 2 deletions src/auth/src/user_provider/static_user_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl StaticUserProvider {
value: value.to_string(),
msg: "StaticUserProviderOption must be in format `<option>:<value>`",
})?;
return match mode {
match mode {
"file" => {
let users = load_credential_from_file(content)?
.context(InvalidConfigSnafu {
Expand All @@ -58,7 +58,7 @@ impl StaticUserProvider {
msg: "StaticUserProviderOption must be in format `file:<path>` or `cmd:<values>`",
}
.fail(),
};
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/// All table names in `information_schema`.
//! All table names in `information_schema`.

pub const TABLES: &str = "tables";
pub const COLUMNS: &str = "columns";
Expand Down
6 changes: 3 additions & 3 deletions src/catalog/src/system_schema/pg_catalog/pg_namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! The `pg_catalog.pg_namespace` table implementation.
//! namespace is a schema in greptime

pub(super) mod oid_map;

use std::sync::{Arc, Weak};
Expand Down Expand Up @@ -40,9 +43,6 @@ use crate::system_schema::utils::tables::{string_column, u32_column};
use crate::system_schema::SystemTable;
use crate::CatalogManager;

/// The `pg_catalog.pg_namespace` table implementation.
/// namespace is a schema in greptime

const NSPNAME: &str = "nspname";
const INIT_CAPACITY: usize = 42;

Expand Down
1 change: 1 addition & 0 deletions src/cmd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub trait App: Send {
}

/// Log the versions of the application, and the arguments passed to the cli.
///
/// `version` should be the same as the output of cli "--version";
/// and the `short_version` is the short version of the codes, often consist of git branch and commit.
pub fn log_versions(version: &str, short_version: &str, app: &str) {
Expand Down
5 changes: 3 additions & 2 deletions src/common/base/src/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ impl From<String> for SecretString {
}
}

/// Wrapper type for values that contains secrets, which attempts to limit
/// accidental exposure and ensure secrets are wiped from memory when dropped.
/// Wrapper type for values that contains secrets.
///
/// It attempts to limit accidental exposure and ensure secrets are wiped from memory when dropped.
/// (e.g. passwords, cryptographic keys, access tokens or other credentials)
///
/// Access to the secret inner value occurs through the [`ExposeSecret`]
Expand Down
5 changes: 3 additions & 2 deletions src/common/catalog/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ pub const INFORMATION_SCHEMA_PROCEDURE_INFO_TABLE_ID: u32 = 34;
/// id for information_schema.region_statistics
pub const INFORMATION_SCHEMA_REGION_STATISTICS_TABLE_ID: u32 = 35;

/// ----- End of information_schema tables -----
// ----- End of information_schema tables -----

/// ----- Begin of pg_catalog tables -----
pub const PG_CATALOG_PG_CLASS_TABLE_ID: u32 = 256;
pub const PG_CATALOG_PG_TYPE_TABLE_ID: u32 = 257;
pub const PG_CATALOG_PG_NAMESPACE_TABLE_ID: u32 = 258;

/// ----- End of pg_catalog tables -----
// ----- End of pg_catalog tables -----

pub const MITO_ENGINE: &str = "mito";
pub const MITO2_ENGINE: &str = "mito2";
pub const METRIC_ENGINE: &str = "metric";
Expand Down
1 change: 1 addition & 0 deletions src/common/greptimedb-telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ pub fn default_get_uuid(working_home: &Option<String>) -> Option<String> {
}

/// Report version info to GreptimeDB.
///
/// We do not collect any identity-sensitive information.
/// This task is scheduled to run every 30 minutes.
/// The task will be disabled default. It can be enabled by setting the build feature `greptimedb-telemetry`
Expand Down
11 changes: 7 additions & 4 deletions src/common/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ pub fn aggr_func_type_store_derive(input: TokenStream) -> TokenStream {
}

/// A struct can be used as a creator for aggregate function if it has been annotated with this
/// attribute first. This attribute add a necessary field which is intended to store the input
/// attribute first.
///
/// This attribute add a necessary field which is intended to store the input
/// data's types to the struct.
/// This attribute is expected to be used along with derive macro [AggrFuncTypeStore].
#[proc_macro_attribute]
Expand All @@ -44,9 +46,10 @@ pub fn as_aggr_func_creator(args: TokenStream, input: TokenStream) -> TokenStrea
}

/// Attribute macro to convert an arithimetic function to a range function. The annotated function
/// should accept servaral arrays as input and return a single value as output. This procedure
/// macro can works on any number of input parameters. Return type can be either primitive type
/// or wrapped in `Option`.
/// should accept servaral arrays as input and return a single value as output.
///
/// This procedure macro can works on any number of input parameters. Return type can be either
/// primitive type or wrapped in `Option`.
///
/// # Example
/// Take `count_over_time()` in PromQL as an example:
Expand Down
1 change: 1 addition & 0 deletions src/common/meta/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub trait ClusterInfo {
}

/// The key of [NodeInfo] in the storage. The format is `__meta_cluster_node_info-{cluster_id}-{role}-{node_id}`.
///
/// This key cannot be used to describe the `Metasrv` because the `Metasrv` does not have
/// a `cluster_id`, it serves multiple clusters.
#[derive(Debug, Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/key/catalog_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct CatalogNameKey<'a> {
pub catalog: &'a str,
}

impl<'a> Default for CatalogNameKey<'a> {
impl Default for CatalogNameKey<'_> {
fn default() -> Self {
Self {
catalog: DEFAULT_CATALOG_NAME,
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/key/datanode_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl DatanodeTableKey {
}
}

impl<'a> MetadataKey<'a, DatanodeTableKey> for DatanodeTableKey {
impl MetadataKey<'_, DatanodeTableKey> for DatanodeTableKey {
fn to_bytes(&self) -> Vec<u8> {
self.to_string().into_bytes()
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/meta/src/key/flow/flow_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ lazy_static! {
/// The layout: `__flow/info/{flow_id}`.
pub struct FlowInfoKey(FlowScoped<FlowInfoKeyInner>);

pub type FlowInfoDecodeResult = Result<Option<DeserializedValueWithBytes<FlowInfoValue>>>;

impl<'a> MetadataKey<'a, FlowInfoKey> for FlowInfoKey {
fn to_bytes(&self) -> Vec<u8> {
self.0.to_bytes()
Expand Down Expand Up @@ -203,9 +205,7 @@ impl FlowInfoManager {
flow_value: &FlowInfoValue,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<FlowInfoValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> FlowInfoDecodeResult,
)> {
let key = FlowInfoKey::new(flow_id).to_bytes();
let txn = Txn::put_if_not_exists(key.clone(), flow_value.try_as_raw_value()?);
Expand Down
8 changes: 4 additions & 4 deletions src/common/meta/src/key/flow/flow_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ lazy_static! {
/// The layout: `__flow/name/{catalog_name}/{flow_name}`.
pub struct FlowNameKey<'a>(FlowScoped<FlowNameKeyInner<'a>>);

pub type FlowNameDecodeResult = Result<Option<DeserializedValueWithBytes<FlowNameValue>>>;

#[allow(dead_code)]
impl<'a> FlowNameKey<'a> {
/// Returns the [FlowNameKey]
Expand Down Expand Up @@ -104,7 +106,7 @@ impl<'a> MetadataKey<'a, FlowNameKeyInner<'a>> for FlowNameKeyInner<'_> {
.into_bytes()
}

fn from_bytes(bytes: &'a [u8]) -> Result<FlowNameKeyInner> {
fn from_bytes(bytes: &'a [u8]) -> Result<FlowNameKeyInner<'a>> {
let key = std::str::from_utf8(bytes).map_err(|e| {
error::InvalidMetadataSnafu {
err_msg: format!(
Expand Down Expand Up @@ -223,9 +225,7 @@ impl FlowNameManager {
flow_id: FlowId,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<FlowNameValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> FlowNameDecodeResult,
)> {
let key = FlowNameKey::new(catalog_name, flow_name);
let raw_key = key.to_bytes();
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/key/node_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl NodeAddressValue {
}
}

impl<'a> MetadataKey<'a, NodeAddressKey> for NodeAddressKey {
impl MetadataKey<'_, NodeAddressKey> for NodeAddressKey {
fn to_bytes(&self) -> Vec<u8> {
self.to_string().into_bytes()
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/key/schema_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct SchemaNameKey<'a> {
pub schema: &'a str,
}

impl<'a> Default for SchemaNameKey<'a> {
impl Default for SchemaNameKey<'_> {
fn default() -> Self {
Self {
catalog: DEFAULT_CATALOG_NAME,
Expand Down
11 changes: 4 additions & 7 deletions src/common/meta/src/key/table_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Display for TableInfoKey {
}
}

impl<'a> MetadataKey<'a, TableInfoKey> for TableInfoKey {
impl MetadataKey<'_, TableInfoKey> for TableInfoKey {
fn to_bytes(&self) -> Vec<u8> {
self.to_string().into_bytes()
}
Expand Down Expand Up @@ -132,6 +132,7 @@ pub type TableInfoManagerRef = Arc<TableInfoManager>;
pub struct TableInfoManager {
kv_backend: KvBackendRef,
}
pub type TableInfoDecodeResult = Result<Option<DeserializedValueWithBytes<TableInfoValue>>>;

impl TableInfoManager {
pub fn new(kv_backend: KvBackendRef) -> Self {
Expand All @@ -145,9 +146,7 @@ impl TableInfoManager {
table_info_value: &TableInfoValue,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<TableInfoValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> TableInfoDecodeResult,
)> {
let key = TableInfoKey::new(table_id);
let raw_key = key.to_bytes();
Expand All @@ -169,9 +168,7 @@ impl TableInfoManager {
new_table_info_value: &TableInfoValue,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<TableInfoValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> TableInfoDecodeResult,
)> {
let key = TableInfoKey::new(table_id);
let raw_key = key.to_bytes();
Expand Down
12 changes: 5 additions & 7 deletions src/common/meta/src/key/table_route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ impl LogicalTableRouteValue {
}
}

impl<'a> MetadataKey<'a, TableRouteKey> for TableRouteKey {
impl MetadataKey<'_, TableRouteKey> for TableRouteKey {
fn to_bytes(&self) -> Vec<u8> {
self.to_string().into_bytes()
}
Expand Down Expand Up @@ -472,6 +472,8 @@ pub struct TableRouteStorage {
kv_backend: KvBackendRef,
}

pub type TableRouteValueDecodeResult = Result<Option<DeserializedValueWithBytes<TableRouteValue>>>;

impl TableRouteStorage {
pub fn new(kv_backend: KvBackendRef) -> Self {
Self { kv_backend }
Expand All @@ -485,9 +487,7 @@ impl TableRouteStorage {
table_route_value: &TableRouteValue,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<TableRouteValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> TableRouteValueDecodeResult,
)> {
let key = TableRouteKey::new(table_id);
let raw_key = key.to_bytes();
Expand All @@ -510,9 +510,7 @@ impl TableRouteStorage {
new_table_route_value: &TableRouteValue,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<TableRouteValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> TableRouteValueDecodeResult,
)> {
let key = TableRouteKey::new(table_id);
let raw_key = key.to_bytes();
Expand Down
12 changes: 5 additions & 7 deletions src/common/meta/src/key/view_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Display for ViewInfoKey {
}
}

impl<'a> MetadataKey<'a, ViewInfoKey> for ViewInfoKey {
impl MetadataKey<'_, ViewInfoKey> for ViewInfoKey {
fn to_bytes(&self) -> Vec<u8> {
self.to_string().into_bytes()
}
Expand Down Expand Up @@ -139,6 +139,8 @@ pub struct ViewInfoManager {

pub type ViewInfoManagerRef = Arc<ViewInfoManager>;

pub type ViewInfoValueDecodeResult = Result<Option<DeserializedValueWithBytes<ViewInfoValue>>>;

impl ViewInfoManager {
pub fn new(kv_backend: KvBackendRef) -> Self {
Self { kv_backend }
Expand All @@ -151,9 +153,7 @@ impl ViewInfoManager {
view_info_value: &ViewInfoValue,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<ViewInfoValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> ViewInfoValueDecodeResult,
)> {
let key = ViewInfoKey::new(view_id);
let raw_key = key.to_bytes();
Expand All @@ -175,9 +175,7 @@ impl ViewInfoManager {
new_view_info_value: &ViewInfoValue,
) -> Result<(
Txn,
impl FnOnce(
&mut TxnOpGetResponseSet,
) -> Result<Option<DeserializedValueWithBytes<ViewInfoValue>>>,
impl FnOnce(&mut TxnOpGetResponseSet) -> ViewInfoValueDecodeResult,
)> {
let key = ViewInfoKey::new(view_id);
let raw_key = key.to_bytes();
Expand Down
4 changes: 2 additions & 2 deletions src/common/meta/src/lock_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub enum CatalogLock<'a> {
Write(&'a str),
}

impl<'a> Display for CatalogLock<'a> {
impl Display for CatalogLock<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let key = match self {
CatalogLock::Read(s) => s,
Expand All @@ -44,7 +44,7 @@ impl<'a> Display for CatalogLock<'a> {
}
}

impl<'a> From<CatalogLock<'a>> for StringKey {
impl From<CatalogLock<'_>> for StringKey {
fn from(value: CatalogLock) -> Self {
match value {
CatalogLock::Write(_) => StringKey::Exclusive(value.to_string()),
Expand Down
Loading

0 comments on commit e328c70

Please sign in to comment.