Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for system table in stats() #834

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading