More serde snapshot cleanup (#22449)
This commit is contained in:
@@ -3,7 +3,7 @@ use {
|
||||
accounts::Accounts,
|
||||
accounts_db::{
|
||||
AccountShrinkThreshold, AccountStorageEntry, AccountsDb, AccountsDbConfig, AppendVecId,
|
||||
AtomicAppendVecId, BankHashInfo, IndexGenerationInfo,
|
||||
AtomicAppendVecId, BankHashInfo, IndexGenerationInfo, SnapshotStorage,
|
||||
},
|
||||
accounts_index::AccountSecondaryIndexes,
|
||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
||||
@@ -14,7 +14,6 @@ use {
|
||||
epoch_stakes::EpochStakes,
|
||||
hardened_unpack::UnpackedAppendVecMap,
|
||||
rent_collector::RentCollector,
|
||||
serde_snapshot::newer::{AppendVecIdSerialized, SerializableStorage},
|
||||
stakes::Stakes,
|
||||
},
|
||||
bincode::{self, config::Options, Error},
|
||||
@@ -47,15 +46,15 @@ use {
|
||||
|
||||
mod common;
|
||||
mod newer;
|
||||
mod storage;
|
||||
mod tests;
|
||||
mod utils;
|
||||
|
||||
use storage::{SerializableStorage, SerializedAppendVecId};
|
||||
|
||||
// a number of test cases in accounts_db use this
|
||||
#[cfg(test)]
|
||||
pub(crate) use self::tests::reconstruct_accounts_db_via_serialization;
|
||||
pub(crate) use crate::accounts_db::{SnapshotStorage, SnapshotStorages};
|
||||
#[allow(unused_imports)]
|
||||
use utils::{serialize_iter_as_map, serialize_iter_as_seq, serialize_iter_as_tuple};
|
||||
pub(crate) use tests::reconstruct_accounts_db_via_serialization;
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
pub(crate) enum SerdeStyle {
|
||||
@@ -465,7 +464,7 @@ where
|
||||
// rename the file to this new path.
|
||||
// **DEVELOPER NOTE:** Keep this check last so that it can short-circuit if
|
||||
// possible.
|
||||
if storage_entry.id() == remapped_append_vec_id as AppendVecIdSerialized
|
||||
if storage_entry.id() == remapped_append_vec_id as SerializedAppendVecId
|
||||
|| std::fs::metadata(&remapped_append_vec_path).is_err()
|
||||
{
|
||||
break (remapped_append_vec_id, remapped_append_vec_path);
|
||||
@@ -476,7 +475,7 @@ where
|
||||
num_collisions.fetch_add(1, Ordering::Relaxed);
|
||||
};
|
||||
// Only rename the file if the new ID is actually different from the original.
|
||||
if storage_entry.id() != remapped_append_vec_id as AppendVecIdSerialized {
|
||||
if storage_entry.id() != remapped_append_vec_id as SerializedAppendVecId {
|
||||
std::fs::rename(append_vec_path, &remapped_append_vec_path)?;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user