show column family sizes at trace level

This commit is contained in:
Charles Hall 2024-10-24 11:57:49 -07:00
parent 2bf1975e75
commit cbdeff003d
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -1,5 +1,5 @@
use std::{
collections::HashSet,
collections::{HashMap, HashSet},
future::Future,
pin::Pin,
sync::{Arc, Mutex, RwLock},
@ -104,6 +104,16 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
}),
)?;
tracing::trace!(
cf_sizes = ?db.live_files().map(|x| {
x.into_iter().fold(HashMap::<_, usize>::new(), |mut acc, x| {
*acc.entry(x.column_family_name).or_default() += x.size;
acc
})
}),
"Size in bytes of all column families",
);
Ok(Arc::new(Engine {
rocks: db,
max_open_files: config.database.rocksdb_max_open_files,