fix pool select idx

This commit is contained in:
weisd
2025-04-21 17:29:00 +08:00
parent 27400394e4
commit 59c008b0ee
4 changed files with 65 additions and 43 deletions
+42 -18
View File
@@ -1,17 +1,17 @@
[workspace] [workspace]
members = [ members = [
"madmin", # Management dashboard and admin API interface "madmin", # Management dashboard and admin API interface
"rustfs", # Core file system implementation "rustfs", # Core file system implementation
"ecstore", # Erasure coding storage implementation "ecstore", # Erasure coding storage implementation
"e2e_test", # End-to-end test suite "e2e_test", # End-to-end test suite
"common/common", # Shared utilities and data structures "common/common", # Shared utilities and data structures
"common/lock", # Distributed locking implementation "common/lock", # Distributed locking implementation
"common/protos", # Protocol buffer definitions "common/protos", # Protocol buffer definitions
"common/workers", # Worker thread pools and task scheduling "common/workers", # Worker thread pools and task scheduling
"iam", # Identity and Access Management "iam", # Identity and Access Management
"crypto", # Cryptography and security features "crypto", # Cryptography and security features
"cli/rustfs-gui", # Graphical user interface client "cli/rustfs-gui", # Graphical user interface client
"crates/obs", # Observability utilities "crates/obs", # Observability utilities
"s3select/api", "s3select/api",
"s3select/query", "s3select/query",
"appauth", "appauth",
@@ -67,7 +67,11 @@ http = "1.3.1"
http-body = "1.0.1" http-body = "1.0.1"
humantime = "2.2.0" humantime = "2.2.0"
jsonwebtoken = "9.3.1" 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" } lock = { path = "./common/lock" }
lazy_static = "1.5.0" lazy_static = "1.5.0"
libsystemd = { version = "0.7" } libsystemd = { version = "0.7" }
@@ -77,12 +81,17 @@ md-5 = "0.10.6"
mime = "0.3.17" mime = "0.3.17"
netif = "0.1.6" netif = "0.1.6"
opentelemetry = { version = "0.29.1" } 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_sdk = { version = "0.29" }
opentelemetry-stdout = { version = "0.29.0" } opentelemetry-stdout = { version = "0.29.0" }
opentelemetry-otlp = { version = "0.29" } opentelemetry-otlp = { version = "0.29" }
opentelemetry-prometheus = { version = "0.29.1" } 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" pin-project-lite = "0.2"
prometheus = "0.14.0" prometheus = "0.14.0"
# pin-utils = "0.1.0" # pin-utils = "0.1.0"
@@ -93,8 +102,19 @@ protobuf = "3.7"
protos = { path = "./common/protos" } protos = { path = "./common/protos" }
rand = "0.8.5" rand = "0.8.5"
rdkafka = { version = "0.37", features = ["tokio"] } 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"] } reqwest = { version = "0.12.15", default-features = false, features = [
rfd = { version = "0.15.3", default-features = false, features = ["xdg-portal", "tokio"] } "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 = "0.8.14"
rmp-serde = "1.3.0" rmp-serde = "1.3.0"
rustfs-obs = { path = "crates/obs", version = "0.0.1" } rustfs-obs = { path = "crates/obs", version = "0.0.1" }
@@ -154,6 +174,10 @@ inherits = "dev"
inherits = "dev" inherits = "dev"
[profile.release] [profile.release]
opt-level = 3 # Optimization Level (0-3) opt-level = 3
lto = true # Optimize when linking lto = "thin"
codegen-units = 1 # Reduce code generation units to improve optimization
[profile.production]
inherits = "release"
lto = "fat"
codegen-units = 1
+2 -4
View File
@@ -99,7 +99,7 @@ impl FileMeta {
Ok((bin_len, &buf[5..])) Ok((bin_len, &buf[5..]))
} }
#[tracing::instrument]
pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> { pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> {
let i = buf.len() as u64; let i = buf.len() as u64;
@@ -711,7 +711,6 @@ impl FileMetaVersion {
Ok(data_dir) Ok(data_dir)
} }
#[tracing::instrument]
pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> { pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> {
let mut cur = Cursor::new(buf); let mut cur = Cursor::new(buf);
@@ -998,7 +997,7 @@ impl FileMetaVersionHeader {
Ok(wr) Ok(wr)
} }
#[tracing::instrument]
pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> { pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> {
let mut cur = Cursor::new(buf); let mut cur = Cursor::new(buf);
let alen = rmp::decode::read_array_len(&mut cur)?; let alen = rmp::decode::read_array_len(&mut cur)?;
@@ -1144,7 +1143,6 @@ pub struct MetaObject {
} }
impl MetaObject { impl MetaObject {
#[tracing::instrument]
pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> { pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> {
let mut cur = Cursor::new(buf); let mut cur = Cursor::new(buf);
-1
View File
@@ -344,7 +344,6 @@ impl CurrentScannerCycle {
Ok(result) Ok(result)
} }
#[tracing::instrument]
pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> { pub fn unmarshal_msg(&mut self, buf: &[u8]) -> Result<u64> {
let mut cur = Cursor::new(buf); let mut cur = Cursor::new(buf);
+21 -20
View File
@@ -695,7 +695,7 @@ impl ECStore {
let at = a.object_info.mod_time.unwrap_or(OffsetDateTime::UNIX_EPOCH); let at = a.object_info.mod_time.unwrap_or(OffsetDateTime::UNIX_EPOCH);
let bt = b.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(); let mut def_pool = PoolObjInfo::default();
@@ -911,29 +911,30 @@ impl ECStore {
// TODO: test order // TODO: test order
idx_res.sort_by(|a, b| { idx_res.sort_by(|a, b| {
if let Some(obj1) = &a.res { let a_mod = if let Some(o1) = &a.res {
if let Some(obj2) = &b.res { o1.mod_time.unwrap_or(OffsetDateTime::UNIX_EPOCH)
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
}
} else { } 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 { if let Some(obj) = res.res {
return Ok((obj, res.idx)); return Ok((obj, res.idx));
} }