From be3c261715be543d7c406a3f7e33ba6c48de85e6 Mon Sep 17 00:00:00 2001 From: BodoBolero Date: Thu, 24 Apr 2025 14:59:02 +0200 Subject: [PATCH] use scc::HashMap instead of DashMap --- Cargo.lock | 17 ++++++++++++++++- Cargo.toml | 2 +- pageserver/Cargo.toml | 2 +- pageserver/src/page_cache.rs | 8 ++++---- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 70fc9aebc8..178038bbf5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4262,7 +4262,6 @@ dependencies = [ "consumption_metrics", "crc32c", "criterion", - "dashmap 6.1.0", "either", "enum-map", "enumset", @@ -4303,6 +4302,7 @@ dependencies = [ "reqwest", "rpds", "rustls 0.23.18", + "scc", "scopeguard", "send-future", "serde", @@ -6077,6 +6077,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scc" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22b2d775fb28f245817589471dd49c5edf64237f4a19d10ce9a92ff4651a27f4" +dependencies = [ + "sdd", +] + [[package]] name = "schannel" version = "0.1.23" @@ -6117,6 +6126,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "621e3680f3e07db4c9c2c3fb07c6223ab2fab2e54bd3c04c3ae037990f428c32" +[[package]] +name = "sdd" +version = "3.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "584e070911c7017da6cb2eb0788d09f43d789029b5877d3e5ecc8acf86ceee21" + [[package]] name = "sec1" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index 3a3716a08a..6453ecd3c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -85,7 +85,6 @@ clashmap = { version = "1.0", features = ["raw-api"] } comfy-table = "7.1" const_format = "0.2" crc32c = "0.6" -dashmap = "6.1" diatomic-waker = { version = "0.2.3" } either = "1.8" enum-map = "2.4.2" @@ -161,6 +160,7 @@ rustc-hash = "1.1.0" rustls = { version = "0.23.16", default-features = false } rustls-pemfile = "2" rustls-pki-types = "1.11" +scc = "2.3.4" scopeguard = "1.1" sysinfo = "0.29.2" sd-notify = "0.4.1" diff --git a/pageserver/Cargo.toml b/pageserver/Cargo.toml index 10ec455715..0e29517afa 100644 --- a/pageserver/Cargo.toml +++ b/pageserver/Cargo.toml @@ -27,7 +27,6 @@ chrono = { workspace = true, features = ["serde"] } clap = { workspace = true, features = ["string"] } consumption_metrics.workspace = true crc32c.workspace = true -dashmap.workspace = true either.workspace = true fail.workspace = true futures.workspace = true @@ -53,6 +52,7 @@ rand.workspace = true range-set-blaze = { version = "0.1.16", features = ["alloc"] } regex.workspace = true rustls.workspace = true +scc.workspace = true scopeguard.workspace = true send-future.workspace = true serde.workspace = true diff --git a/pageserver/src/page_cache.rs b/pageserver/src/page_cache.rs index 3522e17134..d64f6d3c99 100644 --- a/pageserver/src/page_cache.rs +++ b/pageserver/src/page_cache.rs @@ -67,8 +67,8 @@ //! mapping is automatically removed and the slot is marked free. //! -use dashmap::DashMap; -use dashmap::Entry; +use scc::HashMap; +use scc::hash_map::Entry; use std::sync::atomic::{AtomicU8, AtomicU64, AtomicUsize, Ordering}; use std::sync::{Arc, Weak}; use std::time::Duration; @@ -194,7 +194,7 @@ impl SlotInner { } pub struct PageCache { - immutable_page_map: std::sync::Arc::>, + immutable_page_map: std::sync::Arc::>, /// The actual buffers with their metadata. slots: Box<[Slot]>, @@ -511,7 +511,7 @@ impl PageCache { match self.immutable_page_map.entry((*file_id, *blkno)) { Entry::Occupied(entry) => Some(*entry.get()), Entry::Vacant(entry) => { - entry.insert(slot_idx); + entry.insert_entry(slot_idx); None } }