Struct GcStats
pub struct GcStats {
pub watermark: Timestamp,
pub active_transactions: usize,
}Expand description
A snapshot of reclamation state, from Database::stats.
These two are what version reclamation is gated on, which is why they are the pair to alert on. Pruning cannot pass the oldest live snapshot, so a single forgotten transaction stops it for every record at once and chains start growing without limit again.
The signal is watermark flat while writes continue, usually alongside an
active_transactions that only climbs. Neither number means much alone —
a flat watermark on an idle database is just an idle database.
let db = Database::open(Config::in_memory())?;
db.register::<Account>()?;
// A transaction held open pins the watermark for everyone.
let held = db.begin();
assert_eq!(db.stats().active_transactions, 1);
drop(held);
assert_eq!(db.stats().active_transactions, 0);Fields§
§watermark: TimestampThe oldest snapshot any live transaction still reads at, or the read watermark when there are none. Versions superseded at or before this are reclaimable.
active_transactions: usizeLive transactions. A number that only grows is the leak.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GcStats
impl RefUnwindSafe for GcStats
impl Send for GcStats
impl Sync for GcStats
impl Unpin for GcStats
impl UnsafeUnpin for GcStats
impl UnwindSafe for GcStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more