Re-use accounts stores (#12885)

* Re-use accounts_db stores

Creating files and dropping mmap areas can be expensive

* Add test for storage finder

Can encounter an infinite loop when the store is too small, but
smaller than the normal store size.

* Fix storage finding

* Check for strong_count == 1

* try_recycle helper
This commit is contained in:
sakridge
2020-11-04 09:17:05 -08:00
committed by GitHub
parent b0d1ae1d8b
commit 43053dcc90
6 changed files with 459 additions and 77 deletions

View File

@@ -250,11 +250,11 @@ pub fn archive_snapshot_package(snapshot_package: &AccountsPackage) -> Result<()
for storage in snapshot_package.storages.iter().flatten() {
storage.flush()?;
let storage_path = storage.get_path();
let output_path = staging_accounts_dir.join(
storage_path
.file_name()
.expect("Invalid AppendVec file path"),
);
let output_path =
staging_accounts_dir.join(crate::append_vec::AppendVec::new_relative_path(
storage.slot(),
storage.append_vec_id(),
));
// `storage_path` - The file path where the AppendVec itself is located
// `output_path` - The directory where the AppendVec will be placed in the staging directory.