Purge snapshot dirs before loading from an archive (#31283)
* Purge snapshot dirs before loading from an archive * Refine comment * Should not remove the bank_snapshots_dir directory
This commit is contained in:
parent
def2af1653
commit
b2e1d736f9
|
@ -97,7 +97,6 @@ pub fn load_bank_forks(
|
||||||
"Initializing bank snapshot path: {}",
|
"Initializing bank snapshot path: {}",
|
||||||
snapshot_config.bank_snapshots_dir.display()
|
snapshot_config.bank_snapshots_dir.display()
|
||||||
);
|
);
|
||||||
let _ = fs::remove_dir_all(&snapshot_config.bank_snapshots_dir);
|
|
||||||
fs::create_dir_all(&snapshot_config.bank_snapshots_dir)
|
fs::create_dir_all(&snapshot_config.bank_snapshots_dir)
|
||||||
.expect("Couldn't create snapshot directory");
|
.expect("Couldn't create snapshot directory");
|
||||||
|
|
||||||
|
@ -199,6 +198,12 @@ fn bank_forks_from_snapshot(
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Given that we are going to boot from an archive, the accountvecs held in the snapshot dirs for fast-boot should
|
||||||
|
// be released. They will be released by the account_background_service anyway. But in the case of the account_paths
|
||||||
|
// using memory-mounted file system, they are not released early enough to give space for the new append-vecs from
|
||||||
|
// the archives, causing the out-of-memory problem. So, purge the snapshot dirs upfront before loading from the archive.
|
||||||
|
snapshot_utils::purge_old_bank_snapshots(&snapshot_config.bank_snapshots_dir, 0, None);
|
||||||
|
|
||||||
let (deserialized_bank, full_snapshot_archive_info, incremental_snapshot_archive_info) =
|
let (deserialized_bank, full_snapshot_archive_info, incremental_snapshot_archive_info) =
|
||||||
snapshot_utils::bank_from_latest_snapshot_archives(
|
snapshot_utils::bank_from_latest_snapshot_archives(
|
||||||
&snapshot_config.bank_snapshots_dir,
|
&snapshot_config.bank_snapshots_dir,
|
||||||
|
|
Loading…
Reference in New Issue