···1313clap = { version = "4.5.31", features = ["derive"] }
1414dropshot = "0.16.0"
1515env_logger = "0.11.7"
1616-fjall = { version = "2.8.0", features = ["lz4"] }
1616+fjall = { git = "https://github.com/fjall-rs/fjall.git", features = ["lz4"] }
1717getrandom = "0.3.3"
1818http = "1.3.1"
1919jetstream = { path = "../jetstream", features = ["metrics"] }
+10-3
ufos/src/storage_fjall.rs
···12221222 AllTimeRecordsKey::new(new_creates_count.into(), &nsid).to_db_bytes()?,
12231223 ),
12241224 };
12251225- batch.remove(&self.rollups, &old_k); // TODO: when fjall gets weak delete, this will hopefully work way better
12251225+ // remove_weak is allowed here because the secondary ranking index only ever inserts once at a key
12261226+ batch.remove_weak(&self.rollups, &old_k);
12261227 batch.insert(&self.rollups, &new_k, "");
12271228 }
12281229···12461247 AllTimeDidsKey::new(new_dids_estimate.into(), &nsid).to_db_bytes()?,
12471248 ),
12481249 };
12491249- batch.remove(&self.rollups, &old_k); // TODO: when fjall gets weak delete, this will hopefully work way better
12501250+ // remove_weak is allowed here because the secondary ranking index only ever inserts once at a key
12511251+ batch.remove_weak(&self.rollups, &old_k);
12501252 batch.insert(&self.rollups, &new_k, "");
12511253 }
12521254···16191621 histogram!("storage_trim_dirty_nsids").record(completed.len() as f64);
16201622 histogram!("storage_trim_duration").record(dt.as_micros() as f64);
16211623 counter!("storage_trim_removed", "dangling" => "true").increment(total_danglers as u64);
16221622- counter!("storage_trim_removed", "dangling" => "false").increment((total_deleted - total_danglers) as u64);
16241624+ if total_deleted >= total_danglers {
16251625+ counter!("storage_trim_removed", "dangling" => "false").increment((total_deleted - total_danglers) as u64);
16261626+ } else {
16271627+ // TODO: probably think through what's happening here
16281628+ log::warn!("weird trim case: more danglers than deleted? metric will be missing for dangling=false. deleted={total_deleted} danglers={total_danglers}");
16291629+ }
16231630 for c in completed {
16241631 dirty_nsids.remove(&c);
16251632 }