lighthouse/beacon_node/store
Michael Sproul 556190ff46 Compact database on finalization (#1871)
## Issue Addressed

Closes #1866

## Proposed Changes

* Compact the database on finalization. This removes the deleted states from disk completely. Because it happens in the background migrator, it doesn't block other database operations while it runs. On my Medalla node it took about 1 minute and shrank the database from 90GB to 9GB.
* Fix an inefficiency in the pruning algorithm where it would always use the genesis checkpoint as the `old_finalized_checkpoint` when running for the first time after start-up. This would result in loading lots of states one-at-a-time back to genesis, and storing a lot of block roots in memory. The new code stores the old finalized checkpoint on disk and only uses genesis if no checkpoint is already stored. This makes it both backwards compatible _and_ forwards compatible -- no schema change required!
* Introduce two new `INFO` logs to indicate when pruning has started and completed. Users seem to want to know this information without enabling debug logs!
2020-11-09 07:02:21 +00:00
..
benches Fix clippy warnings (#813) 2020-01-21 18:38:56 +11:00
examples Fix clippy warnings (#813) 2020-01-21 18:38:56 +11:00
src Compact database on finalization (#1871) 2020-11-09 07:02:21 +00:00
Cargo.toml Update external deps (#1711) 2020-10-05 08:22:19 +00:00