change blocktree*::storage_size() to return Option<u64> to handle live fs changes (#7401)
This commit is contained in:
parent
12d471e2da
commit
06415de8ee
|
@ -66,16 +66,20 @@ impl LedgerCleanupService {
|
||||||
|
|
||||||
let disk_utilization_post = blocktree.storage_size();
|
let disk_utilization_post = blocktree.storage_size();
|
||||||
|
|
||||||
datapoint_debug!(
|
if let (Some(disk_utilization_pre), Some(disk_utilization_post)) =
|
||||||
"ledger_disk_utilization",
|
(disk_utilization_pre, disk_utilization_post)
|
||||||
("disk_utilization_pre", disk_utilization_pre as i64, i64),
|
{
|
||||||
("disk_utilization_post", disk_utilization_post as i64, i64),
|
datapoint_debug!(
|
||||||
(
|
"ledger_disk_utilization",
|
||||||
"disk_utilization_delta",
|
("disk_utilization_pre", disk_utilization_pre as i64, i64),
|
||||||
(disk_utilization_pre as i64 - disk_utilization_post as i64),
|
("disk_utilization_post", disk_utilization_post as i64, i64),
|
||||||
i64
|
(
|
||||||
)
|
"disk_utilization_delta",
|
||||||
);
|
(disk_utilization_pre as i64 - disk_utilization_post as i64),
|
||||||
|
i64
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1493,7 +1493,7 @@ impl Blocktree {
|
||||||
self.last_root()
|
self.last_root()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn storage_size(&self) -> u64 {
|
pub fn storage_size(&self) -> Option<u64> {
|
||||||
self.db.storage_size()
|
self.db.storage_size()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -580,8 +580,8 @@ impl Database {
|
||||||
self.backend.write(batch.write_batch)
|
self.backend.write(batch.write_batch)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn storage_size(&self) -> u64 {
|
pub fn storage_size(&self) -> Option<u64> {
|
||||||
get_size(&self.path).expect("failure while reading ledger directory size")
|
get_size(&self.path).ok()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue