diff --git a/Cargo.toml b/Cargo.toml index 381305c48..e2ef3b562 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,17 @@ [workspace] members = [ - "madmin", # Management dashboard and admin API interface - "rustfs", # Core file system implementation - "ecstore", # Erasure coding storage implementation - "e2e_test", # End-to-end test suite - "common/common", # Shared utilities and data structures - "common/lock", # Distributed locking implementation - "common/protos", # Protocol buffer definitions + "madmin", # Management dashboard and admin API interface + "rustfs", # Core file system implementation + "ecstore", # Erasure coding storage implementation + "e2e_test", # End-to-end test suite + "common/common", # Shared utilities and data structures + "common/lock", # Distributed locking implementation + "common/protos", # Protocol buffer definitions "common/workers", # Worker thread pools and task scheduling - "iam", # Identity and Access Management - "crypto", # Cryptography and security features + "iam", # Identity and Access Management + "crypto", # Cryptography and security features "cli/rustfs-gui", # Graphical user interface client - "crates/obs", # Observability utilities + "crates/obs", # Observability utilities "s3select/api", "s3select/query", "appauth", @@ -67,7 +67,11 @@ http = "1.3.1" http-body = "1.0.1" humantime = "2.2.0" jsonwebtoken = "9.3.1" -keyring = { version = "3.6.2", features = ["apple-native", "windows-native", "sync-secret-service"] } +keyring = { version = "3.6.2", features = [ + "apple-native", + "windows-native", + "sync-secret-service", +] } lock = { path = "./common/lock" } lazy_static = "1.5.0" libsystemd = { version = "0.7" } @@ -77,12 +81,17 @@ md-5 = "0.10.6" mime = "0.3.17" netif = "0.1.6" opentelemetry = { version = "0.29.1" } -opentelemetry-appender-tracing = { version = "0.29.1", features = ["experimental_use_tracing_span_context", "experimental_metadata_attributes"] } +opentelemetry-appender-tracing = { version = "0.29.1", features = [ + "experimental_use_tracing_span_context", + "experimental_metadata_attributes", +] } opentelemetry_sdk = { version = "0.29" } opentelemetry-stdout = { version = "0.29.0" } opentelemetry-otlp = { version = "0.29" } opentelemetry-prometheus = { version = "0.29.1" } -opentelemetry-semantic-conventions = { version = "0.29.0", features = ["semconv_experimental"] } +opentelemetry-semantic-conventions = { version = "0.29.0", features = [ + "semconv_experimental", +] } pin-project-lite = "0.2" prometheus = "0.14.0" # pin-utils = "0.1.0" @@ -93,8 +102,19 @@ protobuf = "3.7" protos = { path = "./common/protos" } rand = "0.8.5" rdkafka = { version = "0.37", features = ["tokio"] } -reqwest = { version = "0.12.15", default-features = false, features = ["rustls-tls", "charset", "http2", "macos-system-configuration", "stream", "json", "blocking"] } -rfd = { version = "0.15.3", default-features = false, features = ["xdg-portal", "tokio"] } +reqwest = { version = "0.12.15", default-features = false, features = [ + "rustls-tls", + "charset", + "http2", + "macos-system-configuration", + "stream", + "json", + "blocking", +] } +rfd = { version = "0.15.3", default-features = false, features = [ + "xdg-portal", + "tokio", +] } rmp = "0.8.14" rmp-serde = "1.3.0" rustfs-obs = { path = "crates/obs", version = "0.0.1" } @@ -154,6 +174,10 @@ inherits = "dev" inherits = "dev" [profile.release] -opt-level = 3 # Optimization Level (0-3) -lto = true # Optimize when linking -codegen-units = 1 # Reduce code generation units to improve optimization +opt-level = 3 +lto = "thin" + +[profile.production] +inherits = "release" +lto = "fat" +codegen-units = 1 diff --git a/ecstore/src/file_meta.rs b/ecstore/src/file_meta.rs index c9558578e..e4da3882a 100644 --- a/ecstore/src/file_meta.rs +++ b/ecstore/src/file_meta.rs @@ -99,7 +99,7 @@ impl FileMeta { Ok((bin_len, &buf[5..])) } - #[tracing::instrument] + pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result { let i = buf.len() as u64; @@ -711,7 +711,6 @@ impl FileMetaVersion { Ok(data_dir) } - #[tracing::instrument] pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result { let mut cur = Cursor::new(buf); @@ -998,7 +997,7 @@ impl FileMetaVersionHeader { Ok(wr) } - #[tracing::instrument] + pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result { let mut cur = Cursor::new(buf); let alen = rmp::decode::read_array_len(&mut cur)?; @@ -1144,7 +1143,6 @@ pub struct MetaObject { } impl MetaObject { - #[tracing::instrument] pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result { let mut cur = Cursor::new(buf); diff --git a/ecstore/src/heal/data_scanner.rs b/ecstore/src/heal/data_scanner.rs index 315b21fef..78c5b9f64 100644 --- a/ecstore/src/heal/data_scanner.rs +++ b/ecstore/src/heal/data_scanner.rs @@ -344,7 +344,6 @@ impl CurrentScannerCycle { Ok(result) } - #[tracing::instrument] pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result { let mut cur = Cursor::new(buf); diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index 4bd2067f1..927672afb 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -695,7 +695,7 @@ impl ECStore { let at = a.object_info.mod_time.unwrap_or(OffsetDateTime::UNIX_EPOCH); let bt = b.object_info.mod_time.unwrap_or(OffsetDateTime::UNIX_EPOCH); - at.cmp(&bt) + bt.cmp(&at) }); let mut def_pool = PoolObjInfo::default(); @@ -911,29 +911,30 @@ impl ECStore { // TODO: test order idx_res.sort_by(|a, b| { - if let Some(obj1) = &a.res { - if let Some(obj2) = &b.res { - let cmp = obj1.mod_time.cmp(&obj2.mod_time); - match cmp { - // eq use lowest - Ordering::Equal => { - if a.idx < b.idx { - Ordering::Greater - } else { - Ordering::Less - } - } - _ => cmp, - } - } else { - Ordering::Greater - } + let a_mod = if let Some(o1) = &a.res { + o1.mod_time.unwrap_or(OffsetDateTime::UNIX_EPOCH) } else { - Ordering::Less + OffsetDateTime::UNIX_EPOCH + }; + + let b_mod = if let Some(o2) = &b.res { + o2.mod_time.unwrap_or(OffsetDateTime::UNIX_EPOCH) + } else { + OffsetDateTime::UNIX_EPOCH + }; + + if a_mod == b_mod { + if a.idx < b.idx { + return Ordering::Greater; + } else { + return Ordering::Less; + } } + + b_mod.cmp(&a_mod) }); - for res in idx_res { + for res in idx_res.into_iter() { if let Some(obj) = res.res { return Ok((obj, res.idx)); }