From 11d04045e141146374aef8d8d180e29a40c94e2d Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 12 Aug 2025 16:14:11 -0400 Subject: [PATCH] use remove_weak for secondary rank indexes *hopefully* reduces write amplification, read amplification, space amplification, and maybe even compaction stalls? --- ufos/src/storage_fjall.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ufos/src/storage_fjall.rs b/ufos/src/storage_fjall.rs index 87edafb..d93795f 100644 --- a/ufos/src/storage_fjall.rs +++ b/ufos/src/storage_fjall.rs @@ -1222,7 +1222,8 @@ impl FjallWriter { AllTimeRecordsKey::new(new_creates_count.into(), &nsid).to_db_bytes()?, ), }; - batch.remove(&self.rollups, &old_k); // TODO: when fjall gets weak delete, this will hopefully work way better + // remove_weak is allowed here because the secondary ranking index only ever inserts once at a key + batch.remove_weak(&self.rollups, &old_k); batch.insert(&self.rollups, &new_k, ""); } @@ -1246,7 +1247,8 @@ impl FjallWriter { AllTimeDidsKey::new(new_dids_estimate.into(), &nsid).to_db_bytes()?, ), }; - batch.remove(&self.rollups, &old_k); // TODO: when fjall gets weak delete, this will hopefully work way better + // remove_weak is allowed here because the secondary ranking index only ever inserts once at a key + batch.remove_weak(&self.rollups, &old_k); batch.insert(&self.rollups, &new_k, ""); } -- 2.51.2