Skip to content

Commit

Permalink
Account for system table in stats()
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Jul 28, 2024
1 parent e39e0f0 commit 4f05d1f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,12 +1163,21 @@ impl WriteTransaction {
let tables = self.tables.lock().unwrap();
let table_tree = &tables.table_tree;
let data_tree_stats = table_tree.stats()?;

let system_tables = self.system_tables.lock().unwrap();
let system_table_tree = &system_tables.table_tree;
let system_tree_stats = system_table_tree.stats()?;

let freed_tree_stats = self.freed_tree.lock().unwrap().stats()?;

let total_metadata_bytes = data_tree_stats.metadata_bytes()
+ system_tree_stats.metadata_bytes
+ system_tree_stats.stored_leaf_bytes
+ freed_tree_stats.metadata_bytes
+ freed_tree_stats.stored_leaf_bytes;
let total_fragmented =
data_tree_stats.fragmented_bytes() + freed_tree_stats.fragmented_bytes;
let total_fragmented = data_tree_stats.fragmented_bytes()
+ system_tree_stats.fragmented_bytes
+ freed_tree_stats.fragmented_bytes;

Ok(DatabaseStats {
tree_height: data_tree_stats.tree_height(),
Expand Down

0 comments on commit 4f05d1f

Please sign in to comment.