From 90bfaf94b11b1f8296aa45318eeeb1e6bfab2674 Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Thu, 23 Jan 2025 16:46:51 +0800 Subject: [PATCH 1/7] chore: update toolchain to 2024-12-25 --- rust-toolchain.toml | 2 +- src/common/decimal/src/decimal128.rs | 2 +- src/common/meta/src/key/txn_helper.rs | 2 +- src/common/meta/src/lib.rs | 1 - src/common/version/build.rs | 15 +++++++-------- src/meta-srv/src/lib.rs | 1 - .../update_metadata/upgrade_candidate_region.rs | 2 +- src/meta-srv/src/region/supervisor.rs | 2 +- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 674d7d469457..388d16249a95 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2024-10-19" +channel = "nightly-2024-12-25" components = ["rust-analyzer", "llvm-tools"] diff --git a/src/common/decimal/src/decimal128.rs b/src/common/decimal/src/decimal128.rs index fc4331ddfcc0..a83dbada0acb 100644 --- a/src/common/decimal/src/decimal128.rs +++ b/src/common/decimal/src/decimal128.rs @@ -164,7 +164,7 @@ impl FromStr for Decimal128 { type Err = Error; fn from_str(s: &str) -> Result { - let len = s.as_bytes().len(); + let len = s.len(); if len <= BYTES_TO_OVERFLOW_RUST_DECIMAL { let rd = RustDecimal::from_str_exact(s).context(ParseRustDecimalStrSnafu { raw: s })?; Ok(Self::from(rd)) diff --git a/src/common/meta/src/key/txn_helper.rs b/src/common/meta/src/key/txn_helper.rs index e816eef131c1..1511e47b6881 100644 --- a/src/common/meta/src/key/txn_helper.rs +++ b/src/common/meta/src/key/txn_helper.rs @@ -54,7 +54,7 @@ impl TxnOpGetResponseSet { impl From<&mut Vec> for TxnOpGetResponseSet { fn from(value: &mut Vec) -> Self { let value = value - .extract_if(|resp| matches!(resp, TxnOpResponse::ResponseGet(_))) + .extract_if(.., |resp| matches!(resp, TxnOpResponse::ResponseGet(_))) .flat_map(|resp| { // Safety: checked let TxnOpResponse::ResponseGet(r) = resp else { diff --git a/src/common/meta/src/lib.rs b/src/common/meta/src/lib.rs index c00fd3383042..fd6fc775a45e 100644 --- a/src/common/meta/src/lib.rs +++ b/src/common/meta/src/lib.rs @@ -14,7 +14,6 @@ #![feature(assert_matches)] #![feature(btree_extract_if)] -#![feature(async_closure)] #![feature(let_chains)] #![feature(extract_if)] #![feature(hash_extract_if)] diff --git a/src/common/version/build.rs b/src/common/version/build.rs index 7b784d50859c..051a2780858d 100644 --- a/src/common/version/build.rs +++ b/src/common/version/build.rs @@ -19,10 +19,13 @@ use build_data::{format_timestamp, get_source_time}; use shadow_rs::{CARGO_METADATA, CARGO_TREE}; fn main() -> shadow_rs::SdResult<()> { - println!( - "cargo:rerun-if-changed={}/.git/refs/heads", - env!("CARGO_RUSTC_CURRENT_DIR") - ); + // The "CARGO_WORKSPACE_DIR" is set manually (not by Rust itself) in Cargo config file, to + // solve the problem where the "CARGO_MANIFEST_DIR" is not what we want when this repo is + // made as a submodule in another repo. + let src_path = env::var("CARGO_WORKSPACE_DIR").or_else(|_| env::var("CARGO_MANIFEST_DIR"))?; + + // `CARGO_RUSTC_CURRENT_DIR` is removed, use `src_path` instead. + println!("cargo:rerun-if-changed={}/.git/refs/heads", src_path); println!( "cargo:rustc-env=SOURCE_TIMESTAMP={}", @@ -34,10 +37,6 @@ fn main() -> shadow_rs::SdResult<()> { ); build_data::set_BUILD_TIMESTAMP(); - // The "CARGO_WORKSPACE_DIR" is set manually (not by Rust itself) in Cargo config file, to - // solve the problem where the "CARGO_MANIFEST_DIR" is not what we want when this repo is - // made as a submodule in another repo. - let src_path = env::var("CARGO_WORKSPACE_DIR").or_else(|_| env::var("CARGO_MANIFEST_DIR"))?; let out_path = env::var("OUT_DIR")?; let _ = shadow_rs::Shadow::build_with( src_path, diff --git a/src/meta-srv/src/lib.rs b/src/meta-srv/src/lib.rs index 0c5c34370400..6e6e374fd536 100644 --- a/src/meta-srv/src/lib.rs +++ b/src/meta-srv/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(async_closure)] #![feature(result_flattening)] #![feature(assert_matches)] #![feature(extract_if)] diff --git a/src/meta-srv/src/procedure/region_migration/update_metadata/upgrade_candidate_region.rs b/src/meta-srv/src/procedure/region_migration/update_metadata/upgrade_candidate_region.rs index c180456bd47b..54910eab2b66 100644 --- a/src/meta-srv/src/procedure/region_migration/update_metadata/upgrade_candidate_region.rs +++ b/src/meta-srv/src/procedure/region_migration/update_metadata/upgrade_candidate_region.rs @@ -67,7 +67,7 @@ impl UpdateMetadata { // Removes the candidate region in followers. let removed = region_route .follower_peers - .extract_if(|peer| peer.id == candidate.id) + .extract_if(.., |peer| peer.id == candidate.id) .collect::>(); if removed.len() > 1 { diff --git a/src/meta-srv/src/region/supervisor.rs b/src/meta-srv/src/region/supervisor.rs index dfc2bd45fc80..c7d1c653121a 100644 --- a/src/meta-srv/src/region/supervisor.rs +++ b/src/meta-srv/src/region/supervisor.rs @@ -358,7 +358,7 @@ impl RegionSupervisor { } let migrating_regions = regions - .extract_if(|(_, _, region_id)| { + .extract_if(.., |(_, _, region_id)| { self.region_migration_manager.tracker().contains(*region_id) }) .collect::>(); From 92dcec437c33aa42868943bbd316b36f89790e2b Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Thu, 23 Jan 2025 17:19:19 +0800 Subject: [PATCH 2/7] chore: fix clippy --- Cargo.lock | 125 ++++++++++++------ src/api/src/v1/column_def.rs | 2 +- src/catalog/src/kvbackend/client.rs | 2 +- .../datasource/src/file_format/tests.rs | 2 +- src/common/meta/src/ddl/drop_table.rs | 2 +- src/common/query/src/logical_plan.rs | 5 +- src/datatypes/src/types/vector_type.rs | 4 +- src/flow/src/expr.rs | 3 +- src/meta-srv/src/error.rs | 5 +- src/meta-srv/src/service/heartbeat.rs | 2 +- src/mito2/src/compaction.rs | 2 +- src/mito2/src/sst/index.rs | 2 +- src/pipeline/src/etl/value.rs | 2 +- src/puffin/src/puffin_manager/cache.rs | 3 +- src/servers/src/mysql/handler.rs | 4 +- src/sql/src/statements/option_map.rs | 2 +- 16 files changed, 103 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea055ec03d24..183885713e4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4583,6 +4583,19 @@ dependencies = [ "byteorder", ] +[[package]] +name = "generator" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" +dependencies = [ + "cfg-if", + "libc", + "log", + "rustversion", + "windows 0.58.0", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -5357,7 +5370,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -6114,7 +6127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -6257,6 +6270,19 @@ dependencies = [ "prost-types 0.13.3", ] +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "lrlex" version = "0.13.7" @@ -6793,25 +6819,23 @@ dependencies = [ [[package]] name = "moka" -version = "0.12.8" +version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f" +checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926" dependencies = [ "async-lock", - "async-trait", "crossbeam-channel", "crossbeam-epoch", "crossbeam-utils", "event-listener 5.3.1", "futures-util", - "once_cell", + "loom", "parking_lot 0.12.3", - "quanta", + "portable-atomic", "rustc_version", "smallvec", "tagptr", "thiserror 1.0.64", - "triomphe", "uuid", ] @@ -8903,21 +8927,6 @@ dependencies = [ "variadics", ] -[[package]] -name = "quanta" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" -dependencies = [ - "crossbeam-utils", - "libc", - "once_cell", - "raw-cpuid", - "wasi", - "web-sys", - "winapi", -] - [[package]] name = "query" version = "0.12.0" @@ -9186,15 +9195,6 @@ dependencies = [ "thiserror 1.0.64", ] -[[package]] -name = "raw-cpuid" -version = "11.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" -dependencies = [ - "bitflags 2.6.0", -] - [[package]] name = "raw-window-handle" version = "0.5.2" @@ -10086,6 +10086,12 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -11421,7 +11427,7 @@ dependencies = [ "ntapi", "once_cell", "rayon", - "windows", + "windows 0.52.0", ] [[package]] @@ -12633,12 +12639,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "343e926fc669bc8cde4fa3129ab681c63671bae288b1f1081ceee6d9d37904fc" -[[package]] -name = "triomphe" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" - [[package]] name = "try-lock" version = "0.2.5" @@ -13240,7 +13240,17 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "windows-core", + "windows-core 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", "windows-targets 0.52.6", ] @@ -13253,6 +13263,41 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "windows-registry" version = "0.2.0" diff --git a/src/api/src/v1/column_def.rs b/src/api/src/v1/column_def.rs index 6ae453cfdd1e..a1d209c0e74f 100644 --- a/src/api/src/v1/column_def.rs +++ b/src/api/src/v1/column_def.rs @@ -100,7 +100,7 @@ pub fn options_from_column_schema(column_schema: &ColumnSchema) -> Option) -> bool { options .as_ref() - .map_or(false, |o| o.options.contains_key(FULLTEXT_GRPC_KEY)) + .is_some_and(|o| o.options.contains_key(FULLTEXT_GRPC_KEY)) } /// Tries to construct a `ColumnOptions` from the given `FulltextOptions`. diff --git a/src/catalog/src/kvbackend/client.rs b/src/catalog/src/kvbackend/client.rs index 7a098618504e..8818e74a48d1 100644 --- a/src/catalog/src/kvbackend/client.rs +++ b/src/catalog/src/kvbackend/client.rs @@ -303,7 +303,7 @@ impl KvBackend for CachedKvBackend { .lock() .unwrap() .as_ref() - .map_or(false, |v| !self.validate_version(*v)) + .is_some_and(|v| !self.validate_version(*v)) { self.cache.invalidate(key).await; } diff --git a/src/common/datasource/src/file_format/tests.rs b/src/common/datasource/src/file_format/tests.rs index 1ab29350e26b..57c5f0e380b8 100644 --- a/src/common/datasource/src/file_format/tests.rs +++ b/src/common/datasource/src/file_format/tests.rs @@ -42,7 +42,7 @@ struct Test<'a, T: FileOpener> { expected: Vec<&'a str>, } -impl<'a, T: FileOpener> Test<'a, T> { +impl Test<'_, T> { pub async fn run(self) { let result = FileStream::new( &self.config, diff --git a/src/common/meta/src/ddl/drop_table.rs b/src/common/meta/src/ddl/drop_table.rs index d1110cf05958..7720c7ee8ee0 100644 --- a/src/common/meta/src/ddl/drop_table.rs +++ b/src/common/meta/src/ddl/drop_table.rs @@ -78,7 +78,7 @@ impl DropTableProcedure { }) } - pub(crate) async fn on_prepare<'a>(&mut self) -> Result { + pub(crate) async fn on_prepare(&mut self) -> Result { if self.executor.on_prepare(&self.context).await?.stop() { return Ok(Status::done()); } diff --git a/src/common/query/src/logical_plan.rs b/src/common/query/src/logical_plan.rs index 135ad6391850..6dc94307b8b8 100644 --- a/src/common/query/src/logical_plan.rs +++ b/src/common/query/src/logical_plan.rs @@ -92,10 +92,7 @@ pub fn rename_logical_plan_columns( }; let (qualifier_rename, field_rename) = - match plan.schema().qualified_field_from_column(&old_column) { - Ok(qualifier_and_field) => qualifier_and_field, - Err(err) => return Err(err), - }; + plan.schema().qualified_field_from_column(&old_column)?; for (qualifier, field) in plan.schema().iter() { if qualifier.eq(&qualifier_rename) && field.as_ref() == field_rename { diff --git a/src/datatypes/src/types/vector_type.rs b/src/datatypes/src/types/vector_type.rs index 77f85ba897e9..302e6f23e2ad 100644 --- a/src/datatypes/src/types/vector_type.rs +++ b/src/datatypes/src/types/vector_type.rs @@ -115,7 +115,7 @@ pub fn parse_string_to_vector_type_value(s: &str, dim: Option) -> Result) -> Result>>()?; // Check dimension - if dim.map_or(false, |d| d as usize != elements.len()) { + if dim.is_some_and(|d| d as usize != elements.len()) { return InvalidVectorSnafu { msg: format!("Failed to parse {s} to Vector value: wrong dimension"), } diff --git a/src/flow/src/expr.rs b/src/flow/src/expr.rs index 2696959f5f1b..a3c12a974247 100644 --- a/src/flow/src/expr.rs +++ b/src/flow/src/expr.rs @@ -320,8 +320,7 @@ impl VectorDiff { fn try_new(vector: VectorRef, diff: Option) -> Result { ensure!( - diff.as_ref() - .map_or(true, |diff| diff.len() == vector.len()), + diff.as_ref().is_none_or(|diff| diff.len() == vector.len()), InvalidArgumentSnafu { reason: "Length of vector and diff should be the same" } diff --git a/src/meta-srv/src/error.rs b/src/meta-srv/src/error.rs index 37722c1c58ce..ab86665c01c1 100644 --- a/src/meta-srv/src/error.rs +++ b/src/meta-srv/src/error.rs @@ -897,9 +897,6 @@ pub(crate) fn match_for_io_error(err_status: &tonic::Status) -> Option<&std::io: } } - err = match err.source() { - Some(err) => err, - None => return None, - }; + err = err.source()?; } } diff --git a/src/meta-srv/src/service/heartbeat.rs b/src/meta-srv/src/service/heartbeat.rs index ef3d30b4d933..3d839fd08259 100644 --- a/src/meta-srv/src/service/heartbeat.rs +++ b/src/meta-srv/src/service/heartbeat.rs @@ -80,7 +80,7 @@ impl heartbeat_server::Heartbeat for Metasrv { .await .map_err(|e| e.into()); - is_not_leader = res.as_ref().map_or(false, |r| r.is_not_leader()); + is_not_leader = res.as_ref().is_ok_and(|r| r.is_not_leader()); debug!("Sending heartbeat response: {:?}", res); diff --git a/src/mito2/src/compaction.rs b/src/mito2/src/compaction.rs index 1ea42a91b8ad..14edc748eb47 100644 --- a/src/mito2/src/compaction.rs +++ b/src/mito2/src/compaction.rs @@ -629,7 +629,7 @@ struct CompactionSstReaderBuilder<'a> { merge_mode: MergeMode, } -impl<'a> CompactionSstReaderBuilder<'a> { +impl CompactionSstReaderBuilder<'_> { /// Builds [BoxedBatchReader] that reads all SST files and yields batches in primary key order. async fn build_sst_reader(self) -> Result { let mut scan_input = ScanInput::new(self.sst_layer, ProjectionMapper::all(&self.metadata)?) diff --git a/src/mito2/src/sst/index.rs b/src/mito2/src/sst/index.rs index 125a639d8aed..311b2d0191fe 100644 --- a/src/mito2/src/sst/index.rs +++ b/src/mito2/src/sst/index.rs @@ -182,7 +182,7 @@ pub(crate) struct IndexerBuilder<'a> { pub(crate) bloom_filter_index_config: BloomFilterConfig, } -impl<'a> IndexerBuilder<'a> { +impl IndexerBuilder<'_> { /// Sanity check for arguments and create a new [Indexer] if arguments are valid. pub(crate) async fn build(self) -> Indexer { let mut indexer = Indexer { diff --git a/src/pipeline/src/etl/value.rs b/src/pipeline/src/etl/value.rs index fee9a2c52742..3657bb914cf7 100644 --- a/src/pipeline/src/etl/value.rs +++ b/src/pipeline/src/etl/value.rs @@ -781,7 +781,7 @@ impl JsonLike for Value { if left.len() != right.len() { false } else { - left.iter().zip(right).map(|(a, b)| a.eq(&b)).all(|a| a) + left.iter().zip(right).all(|(a, b)| a.eq(&b)) } } diff --git a/src/puffin/src/puffin_manager/cache.rs b/src/puffin/src/puffin_manager/cache.rs index 66fcb36bf9c2..faf5e24d9a5c 100644 --- a/src/puffin/src/puffin_manager/cache.rs +++ b/src/puffin/src/puffin_manager/cache.rs @@ -27,8 +27,9 @@ pub struct PuffinMetadataCache { cache: moka::sync::Cache>, } +#[allow(clippy::ptr_arg)] fn puffin_metadata_weight(k: &String, v: &Arc) -> u32 { - (k.as_bytes().len() + v.memory_usage()) as u32 + (k.len() + v.memory_usage()) as u32 } impl PuffinMetadataCache { diff --git a/src/servers/src/mysql/handler.rs b/src/servers/src/mysql/handler.rs index 0a1f868ecff7..49dadc545ad6 100644 --- a/src/servers/src/mysql/handler.rs +++ b/src/servers/src/mysql/handler.rs @@ -244,11 +244,11 @@ impl MysqlInstanceShim { Ok((params, columns)) } - async fn do_execute<'a>( + async fn do_execute( &mut self, query_ctx: QueryContextRef, stmt_key: String, - params: Params<'a>, + params: Params<'_>, ) -> Result>> { let sql_plan = match self.plan(&stmt_key) { None => { diff --git a/src/sql/src/statements/option_map.rs b/src/sql/src/statements/option_map.rs index d66cadf16461..6e758c19b2b9 100644 --- a/src/sql/src/statements/option_map.rs +++ b/src/sql/src/statements/option_map.rs @@ -122,7 +122,7 @@ impl PartialEq for OptionMap { other .secrets .get(key) - .map_or(false, |v| value.expose_secret() == v.expose_secret()) + .is_some_and(|v| value.expose_secret() == v.expose_secret()) }) } } From 91efdf3795170d3492da81a6990582aa5a3e081c Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Fri, 24 Jan 2025 14:04:15 +0800 Subject: [PATCH 3/7] feat: update flakes --- flake.lock | 18 +++++++++--------- flake.nix | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 51ac83b30853..cfea27d34bb3 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1737527504, - "narHash": "sha256-Z8S5gLPdIYeKwBXDaSxlJ72ZmiilYhu3418h3RSQZA0=", + "lastModified": 1737613896, + "narHash": "sha256-ldqXIglq74C7yKMFUzrS9xMT/EVs26vZpOD68Sh7OcU=", "owner": "nix-community", "repo": "fenix", - "rev": "aa13f23e3e91b95377a693ac655bbc6545ebec0d", + "rev": "303a062fdd8e89f233db05868468975d17855d80", "type": "github" }, "original": { @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1737404927, - "narHash": "sha256-e1WgPJpIYbOuokjgylcsuoEUCB4Jl2rQXa2LUD6XAG8=", + "lastModified": 1737569578, + "narHash": "sha256-6qY0pk2QmUtBT9Mywdvif0i/CLVgpCjMUn6g9vB+f3M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ae584d90cbd0396a422289ee3efb1f1c9d141dc3", + "rev": "47addd76727f42d351590c905d9d1905ca895b82", "type": "github" }, "original": { @@ -65,11 +65,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1737453499, - "narHash": "sha256-fa5AJI9mjFU2oVXqdCq2oA2pripAXbHzkUkewJRQpxA=", + "lastModified": 1737581772, + "narHash": "sha256-t1P2Pe3FAX9TlJsCZbmJ3wn+C4qr6aSMypAOu8WNsN0=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "0b68402d781955d526b80e5d479e9e47addb4075", + "rev": "582af7ee9c8d84f5d534272fc7de9f292bd849be", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 829d33e20812..4daa37395949 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ mold (fenix.packages.${system}.fromToolchainFile { dir = ./.; - sha256 = "sha256-9GnMWM2pjzawUuVU7EbnPMn79rMknaA4EaxipyTgqig="; + sha256 = "sha256-f/CVA1EC61EWbh0SjaRNhLL0Ypx2ObupbzigZp8NmL4="; }) cargo-nextest cargo-llvm-cov From 4352086e187db6d2a70a0f1eaeba492f3859e6f8 Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Fri, 24 Jan 2025 14:42:31 +0800 Subject: [PATCH 4/7] chore: remove `rerun-if-changed` for now --- src/common/version/build.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/common/version/build.rs b/src/common/version/build.rs index 051a2780858d..13fe29d63efe 100644 --- a/src/common/version/build.rs +++ b/src/common/version/build.rs @@ -19,14 +19,6 @@ use build_data::{format_timestamp, get_source_time}; use shadow_rs::{CARGO_METADATA, CARGO_TREE}; fn main() -> shadow_rs::SdResult<()> { - // The "CARGO_WORKSPACE_DIR" is set manually (not by Rust itself) in Cargo config file, to - // solve the problem where the "CARGO_MANIFEST_DIR" is not what we want when this repo is - // made as a submodule in another repo. - let src_path = env::var("CARGO_WORKSPACE_DIR").or_else(|_| env::var("CARGO_MANIFEST_DIR"))?; - - // `CARGO_RUSTC_CURRENT_DIR` is removed, use `src_path` instead. - println!("cargo:rerun-if-changed={}/.git/refs/heads", src_path); - println!( "cargo:rustc-env=SOURCE_TIMESTAMP={}", if let Ok(t) = get_source_time() { @@ -37,6 +29,10 @@ fn main() -> shadow_rs::SdResult<()> { ); build_data::set_BUILD_TIMESTAMP(); + // The "CARGO_WORKSPACE_DIR" is set manually (not by Rust itself) in Cargo config file, to + // solve the problem where the "CARGO_MANIFEST_DIR" is not what we want when this repo is + // made as a submodule in another repo. + let src_path = env::var("CARGO_WORKSPACE_DIR").or_else(|_| env::var("CARGO_MANIFEST_DIR"))?; let out_path = env::var("OUT_DIR")?; let _ = shadow_rs::Shadow::build_with( src_path, From fe9922ff5395eb062dc92b5d11b418980909570d Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Fri, 24 Jan 2025 15:30:38 +0800 Subject: [PATCH 5/7] chore: update shadow-rs --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 2 +- src/common/version/build.rs | 16 ++++++++++------ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 183885713e4d..4f8e1653e8f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4691,9 +4691,9 @@ checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "git2" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" +checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff" dependencies = [ "bitflags 2.6.0", "libc", @@ -5610,9 +5610,9 @@ dependencies = [ [[package]] name = "is_debug" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d198e9919d9822d5f7083ba8530e04de87841eaf21ead9af8f2304efd57c89" +checksum = "e8ea828c9d6638a5bd3d8b14e37502b4d56cae910ccf8a5b7f51c7a0eb1d0508" [[package]] name = "is_terminal_polyfill" @@ -6100,9 +6100,9 @@ dependencies = [ [[package]] name = "libgit2-sys" -version = "0.17.0+1.8.1" +version = "0.18.0+1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" +checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec" dependencies = [ "cc", "libc", @@ -6127,7 +6127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -10494,9 +10494,9 @@ dependencies = [ [[package]] name = "shadow-rs" -version = "0.35.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2311e39772c00391875f40e34d43efef247b23930143a70ca5fbec9505937420" +checksum = "69d433b5df1e1958a668457ebe4a9c5b7bcfe844f4eb2276ac43cf273baddd54" dependencies = [ "const_format", "git2", diff --git a/Cargo.toml b/Cargo.toml index a7c5b5d5de08..c094a2d651a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -182,7 +182,7 @@ rustls = { version = "0.23.20", default-features = false } # override by patch, serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0", features = ["float_roundtrip"] } serde_with = "3" -shadow-rs = "0.35" +shadow-rs = "0.38" similar-asserts = "1.6.0" smallvec = { version = "1", features = ["serde"] } snafu = "0.8" diff --git a/src/common/version/build.rs b/src/common/version/build.rs index 13fe29d63efe..aaa1adc4b76a 100644 --- a/src/common/version/build.rs +++ b/src/common/version/build.rs @@ -16,7 +16,7 @@ use std::collections::BTreeSet; use std::env; use build_data::{format_timestamp, get_source_time}; -use shadow_rs::{CARGO_METADATA, CARGO_TREE}; +use shadow_rs::{BuildPattern, ShadowBuilder, CARGO_METADATA, CARGO_TREE}; fn main() -> shadow_rs::SdResult<()> { println!( @@ -34,10 +34,14 @@ fn main() -> shadow_rs::SdResult<()> { // made as a submodule in another repo. let src_path = env::var("CARGO_WORKSPACE_DIR").or_else(|_| env::var("CARGO_MANIFEST_DIR"))?; let out_path = env::var("OUT_DIR")?; - let _ = shadow_rs::Shadow::build_with( - src_path, - out_path, - BTreeSet::from([CARGO_METADATA, CARGO_TREE]), - )?; + + let _ = ShadowBuilder::builder() + .build_pattern(BuildPattern::Lazy) + .src_path(src_path) + .out_path(out_path) + .deny_const(BTreeSet::from([CARGO_METADATA, CARGO_TREE])) + .build() + .unwrap(); + Ok(()) } From 9d0fa5d5b55dc3a547be6d73ee010af4a6aad3f9 Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Fri, 24 Jan 2025 16:41:01 +0800 Subject: [PATCH 6/7] fix: clippy --- src/puffin/src/puffin_manager/cache.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/puffin/src/puffin_manager/cache.rs b/src/puffin/src/puffin_manager/cache.rs index faf5e24d9a5c..049aa4d4a6ed 100644 --- a/src/puffin/src/puffin_manager/cache.rs +++ b/src/puffin/src/puffin_manager/cache.rs @@ -27,8 +27,7 @@ pub struct PuffinMetadataCache { cache: moka::sync::Cache>, } -#[allow(clippy::ptr_arg)] -fn puffin_metadata_weight(k: &String, v: &Arc) -> u32 { +fn puffin_metadata_weight(k: &str, v: &Arc) -> u32 { (k.len() + v.memory_usage()) as u32 } @@ -38,7 +37,7 @@ impl PuffinMetadataCache { Self { cache: moka::sync::CacheBuilder::new(capacity) .name("puffin_metadata") - .weigher(puffin_metadata_weight) + .weigher(|k: &String, v| puffin_metadata_weight(k, v)) .eviction_listener(|k, v, _cause| { let size = puffin_metadata_weight(&k, &v); cache_bytes From cc2a8c81741d54ae9fb76c59b5362bb26ab6a0b3 Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Fri, 24 Jan 2025 17:11:02 +0800 Subject: [PATCH 7/7] chore: update version in DEV_BUILDER_IMAGE_TAG --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e68c0f29c8c6..98fd3db1be9d 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ CARGO_BUILD_OPTS := --locked IMAGE_REGISTRY ?= docker.io IMAGE_NAMESPACE ?= greptime IMAGE_TAG ?= latest -DEV_BUILDER_IMAGE_TAG ?= 2024-10-19-9b9784a5-20250124053033 +DEV_BUILDER_IMAGE_TAG ?= 2024-12-25-9d0fa5d5-20250124085746 BUILDX_MULTI_PLATFORM_BUILD ?= false BUILDX_BUILDER_NAME ?= gtbuilder BASE_IMAGE ?= ubuntu