diff --git a/Cargo.lock b/Cargo.lock index 181e24440cc4b..538b66fb8413f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3682,9 +3682,9 @@ dependencies = [ [[package]] name = "lgalloc" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2879fd18080c6076399d8ace2fafaedf994e47bdd6b75462266077f7926b6374" +checksum = "194eb6220fcd2399f0342d2e8e24b8d41e22e037b2f34b1d4cf7cfba228f8cc6" dependencies = [ "crossbeam-deque", "libc", diff --git a/misc/cargo-vet/config.toml b/misc/cargo-vet/config.toml index 9a8e5333adc5e..297c174ed0823 100644 --- a/misc/cargo-vet/config.toml +++ b/misc/cargo-vet/config.toml @@ -572,7 +572,7 @@ version = "1.3.0" criteria = "safe-to-deploy" [[exemptions.lgalloc]] -version = "0.3.1" +version = "0.4.0" criteria = "safe-to-deploy" [[exemptions.libc]] diff --git a/src/compute/Cargo.toml b/src/compute/Cargo.toml index 53d431bbc27ad..ca48a29ae4083 100644 --- a/src/compute/Cargo.toml +++ b/src/compute/Cargo.toml @@ -21,7 +21,7 @@ differential-dataflow = "0.13.1" differential-dogs3 = "0.1.1" futures = "0.3.25" itertools = "0.10.5" -lgalloc = "0.3" +lgalloc = "0.4" mz-build-info = { path = "../build-info" } mz-cluster = { path = "../cluster" } mz-cluster-client = { path = "../cluster-client" } diff --git a/src/metrics/Cargo.toml b/src/metrics/Cargo.toml index b136e6b41daf4..5668e14b11d0b 100644 --- a/src/metrics/Cargo.toml +++ b/src/metrics/Cargo.toml @@ -10,7 +10,7 @@ publish = false workspace = true [dependencies] -lgalloc = "0.3" +lgalloc = "0.4" libc = "0.2.138" mz-ore = { path = "../ore", features = ["metrics"] } paste = "1.0" diff --git a/src/metrics/src/lgalloc.rs b/src/metrics/src/lgalloc.rs index 4eb461ba0367d..33035a2624780 100644 --- a/src/metrics/src/lgalloc.rs +++ b/src/metrics/src/lgalloc.rs @@ -57,7 +57,6 @@ macro_rules! metrics_size_class { ) => { paste! { struct LgMetrics { - stats: lgalloc::LgAllocStats, size_class: BTreeMap, $($metric: raw::UIntGaugeVec,)* $($f_metric: raw::UIntGaugeVec,)* @@ -70,7 +69,6 @@ macro_rules! metrics_size_class { fn new(registry: &MetricsRegistry) -> Self { Self { size_class: BTreeMap::default(), - stats: lgalloc::LgAllocStats::default(), $($metric: registry.register(mz_ore::metric!( name: concat!(stringify!($namespace), "_", stringify!($metric)), help: $desc, @@ -93,22 +91,25 @@ macro_rules! metrics_size_class { }) } fn update(&mut self) { - let mut stats = std::mem::take(&mut self.stats); - lgalloc::lgalloc_stats(&mut stats); + let stats = lgalloc::lgalloc_stats(); for sc in &stats.size_class { let sc_stats = self.get_size_class(sc.size_class); $(sc_stats.$metric.set(($conv)(u64::cast_from(sc.$name), sc));)* } let mut accums = BTreeMap::new(); - for file_stat in &stats.file_stats { - let accum: &mut FileStatsAccum = accums.entry(file_stat.size_class).or_default(); - accum.add_assign(file_stat); + match &stats.file_stats { + Ok(file_stats) => { + for file_stat in file_stats { + let accum: &mut FileStatsAccum = accums.entry(file_stat.size_class).or_default(); + accum.add_assign(file_stat); + } + } + Err(err) => eprintln!("Failed to get file stats: {err}"), } for (size_class, accum) in accums { let sc_stats = self.get_size_class(size_class); $(sc_stats.$f_metric.set(u64::cast_from(accum.$f_name));)* } - self.stats = stats; } } } diff --git a/src/ore/Cargo.toml b/src/ore/Cargo.toml index ec74b4ff7e527..892047234fd4f 100644 --- a/src/ore/Cargo.toml +++ b/src/ore/Cargo.toml @@ -32,7 +32,7 @@ flatcontainer = { version = "0.5.0", optional = true } futures = { version = "0.3.25", optional = true } hibitset = { version = "0.6.4", optional = true } itertools = "0.10.5" -lgalloc = { version = "0.3", optional = true } +lgalloc = { version = "0.4", optional = true } libc = { version = "0.2.138", optional = true } mz-ore-proc = { path = "../ore-proc", default-features = false } num = "0.4.0" diff --git a/src/timely-util/Cargo.toml b/src/timely-util/Cargo.toml index 56dd1a93e6284..e022e815da632 100644 --- a/src/timely-util/Cargo.toml +++ b/src/timely-util/Cargo.toml @@ -15,7 +15,7 @@ columnation = "0.1.0" differential-dataflow = "0.13.1" either = "1" futures-util = "0.3.25" -lgalloc = "0.3" +lgalloc = "0.4" mz-ore = { path = "../ore", features = ["async", "process", "tracing_", "test"] } num-traits = "0.2" proptest = { version = "1.0.0", default-features = false, features = ["std"] }