diff --git a/fuzz/fuzz_targets/fuzz_redb.rs b/fuzz/fuzz_targets/fuzz_redb.rs index 2beff1ec..599784d0 100644 --- a/fuzz/fuzz_targets/fuzz_redb.rs +++ b/fuzz/fuzz_targets/fuzz_redb.rs @@ -527,7 +527,7 @@ fn exec_table_crash_support(config: &FuzzConfig, apply: fn(WriteTransa txn.commit().unwrap(); db.begin_write().unwrap().commit().unwrap(); let txn = db.begin_write().unwrap(); - let baseline_allocated_pages = txn.stats().unwrap().allocated_pages(); + let baseline_allocated_pages = txn.stats().unwrap().allocated_pages() - txn.num_region_tracker_pages(); txn.abort().unwrap(); countdown.store(old_countdown, Ordering::SeqCst); @@ -686,7 +686,7 @@ fn exec_table_crash_support(config: &FuzzConfig, apply: fn(WriteTransa } let txn = db.begin_write().unwrap(); - let allocated_pages = txn.stats().unwrap().allocated_pages(); + let allocated_pages = txn.stats().unwrap().allocated_pages() - txn.num_region_tracker_pages(); txn.abort().unwrap(); assert_eq!(allocated_pages, baseline_allocated_pages, "Found {} allocated pages at shutdown, expected {}", allocated_pages, baseline_allocated_pages); diff --git a/src/transactions.rs b/src/transactions.rs index e290ef18..732cbfc1 100644 --- a/src/transactions.rs +++ b/src/transactions.rs @@ -1320,6 +1320,11 @@ impl WriteTransaction { }) } + #[cfg(any(test, fuzzing))] + pub fn num_region_tracker_pages(&self) -> u64 { + 1 << self.mem.tracker_page().page_order + } + #[allow(dead_code)] pub(crate) fn print_debug(&self) -> Result { // Flush any pending updates to make sure we get the latest root