mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 13:58:28 +00:00
Conserve disk space by raising default SPRP (#3137)
## Proposed Changes Increase the default `--slots-per-restore-point` to 8192 for a 4x reduction in freezer DB disk usage. Existing nodes that use the previous default of 2048 will be left unchanged. Newly synced nodes (with or without checkpoint sync) will use the new 8192 default. Long-term we could do away with the freezer DB entirely for validator-only nodes, but this change is much simpler and grants us some extra space in the short term. We can also roll it out gradually across our nodes by purging databases one by one, while keeping the Ansible config the same. ## Additional Info We ignore a change from 2048 to 8192 if the user hasn't set the 8192 explicitly. We fire a debug log in the case where we do ignore: ``` DEBG Ignoring slots-per-restore-point config in favour of on-disk value, on_disk: 2048, config: 8192 ```
This commit is contained in:
@@ -804,6 +804,40 @@ fn slots_per_restore_point_flag() {
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| assert_eq!(config.store.slots_per_restore_point, 64));
|
||||
}
|
||||
#[test]
|
||||
fn slots_per_restore_point_update_prev_default() {
|
||||
use beacon_node::beacon_chain::store::config::{
|
||||
DEFAULT_SLOTS_PER_RESTORE_POINT, PREV_DEFAULT_SLOTS_PER_RESTORE_POINT,
|
||||
};
|
||||
|
||||
CommandLineTest::new()
|
||||
.flag("slots-per-restore-point", Some("2048"))
|
||||
.run_with_zero_port()
|
||||
.with_config_and_dir(|config, dir| {
|
||||
// Check that 2048 is the previous default.
|
||||
assert_eq!(
|
||||
config.store.slots_per_restore_point,
|
||||
PREV_DEFAULT_SLOTS_PER_RESTORE_POINT
|
||||
);
|
||||
|
||||
// Restart the BN with the same datadir and the new default SPRP. It should
|
||||
// allow this.
|
||||
CommandLineTest::new()
|
||||
.flag("datadir", Some(&dir.path().display().to_string()))
|
||||
.flag("zero-ports", None)
|
||||
.run_with_no_datadir()
|
||||
.with_config(|config| {
|
||||
// The dumped config will have the new default 8192 value, but the fact that
|
||||
// the BN started and ran (with the same datadir) means that the override
|
||||
// was successful.
|
||||
assert_eq!(
|
||||
config.store.slots_per_restore_point,
|
||||
DEFAULT_SLOTS_PER_RESTORE_POINT
|
||||
);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_cache_size_flag() {
|
||||
CommandLineTest::new()
|
||||
|
||||
Reference in New Issue
Block a user