|
@@ -6,6 +6,7 @@ use {
|
|
|
epoch_stakes::VersionedEpochStakes,
|
|
epoch_stakes::VersionedEpochStakes,
|
|
|
rent_collector::RentCollector,
|
|
rent_collector::RentCollector,
|
|
|
runtime_config::RuntimeConfig,
|
|
runtime_config::RuntimeConfig,
|
|
|
|
|
+ serde_snapshot::storage::SerdeObsoleteAccounts,
|
|
|
snapshot_utils::{SnapshotError, StorageAndNextAccountsFileId},
|
|
snapshot_utils::{SnapshotError, StorageAndNextAccountsFileId},
|
|
|
stake_account::StakeAccount,
|
|
stake_account::StakeAccount,
|
|
|
stakes::{serialize_stake_accounts_to_delegation_format, Stakes},
|
|
stakes::{serialize_stake_accounts_to_delegation_format, Stakes},
|
|
@@ -24,6 +25,7 @@ use {
|
|
|
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
|
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
|
|
ancestors::AncestorsForSerialization,
|
|
ancestors::AncestorsForSerialization,
|
|
|
blockhash_queue::BlockhashQueue,
|
|
blockhash_queue::BlockhashQueue,
|
|
|
|
|
+ ObsoleteAccounts,
|
|
|
},
|
|
},
|
|
|
solana_clock::{Epoch, Slot, UnixTimestamp},
|
|
solana_clock::{Epoch, Slot, UnixTimestamp},
|
|
|
solana_epoch_schedule::EpochSchedule,
|
|
solana_epoch_schedule::EpochSchedule,
|
|
@@ -852,15 +854,35 @@ pub(crate) fn reconstruct_single_storage(
|
|
|
slot: &Slot,
|
|
slot: &Slot,
|
|
|
append_vec_path: &Path,
|
|
append_vec_path: &Path,
|
|
|
current_len: usize,
|
|
current_len: usize,
|
|
|
- append_vec_id: AccountsFileId,
|
|
|
|
|
|
|
+ id: AccountsFileId,
|
|
|
storage_access: StorageAccess,
|
|
storage_access: StorageAccess,
|
|
|
|
|
+ obsolete_accounts: Option<SerdeObsoleteAccounts>,
|
|
|
) -> Result<Arc<AccountStorageEntry>, SnapshotError> {
|
|
) -> Result<Arc<AccountStorageEntry>, SnapshotError> {
|
|
|
|
|
+ // When restoring from an archive, obsolete accounts will always be `None`
|
|
|
|
|
+ // When restoring from fastboot, obsolete accounts will be 'Some' if the storage contained
|
|
|
|
|
+ // accounts marked obsolete at the time the snapshot was taken.
|
|
|
|
|
+ let (current_len, obsolete_accounts) = if let Some(obsolete_accounts) = obsolete_accounts {
|
|
|
|
|
+ let updated_len = current_len + obsolete_accounts.bytes as usize;
|
|
|
|
|
+ let id = id as SerializedAccountsFileId;
|
|
|
|
|
+ if obsolete_accounts.id != id {
|
|
|
|
|
+ return Err(SnapshotError::MismatchedAccountsFileId(
|
|
|
|
|
+ id,
|
|
|
|
|
+ obsolete_accounts.id,
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ (updated_len, obsolete_accounts.accounts)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ (current_len, ObsoleteAccounts::default())
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
let accounts_file =
|
|
let accounts_file =
|
|
|
AccountsFile::new_for_startup(append_vec_path, current_len, storage_access)?;
|
|
AccountsFile::new_for_startup(append_vec_path, current_len, storage_access)?;
|
|
|
Ok(Arc::new(AccountStorageEntry::new_existing(
|
|
Ok(Arc::new(AccountStorageEntry::new_existing(
|
|
|
*slot,
|
|
*slot,
|
|
|
- append_vec_id,
|
|
|
|
|
|
|
+ id,
|
|
|
accounts_file,
|
|
accounts_file,
|
|
|
|
|
+ obsolete_accounts,
|
|
|
)))
|
|
)))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -959,6 +981,7 @@ pub(crate) fn remap_and_reconstruct_single_storage(
|
|
|
current_len,
|
|
current_len,
|
|
|
remapped_append_vec_id,
|
|
remapped_append_vec_id,
|
|
|
storage_access,
|
|
storage_access,
|
|
|
|
|
+ None,
|
|
|
)?;
|
|
)?;
|
|
|
Ok(storage)
|
|
Ok(storage)
|
|
|
}
|
|
}
|