Add accounts_data_len to bank snapshot (#23714)
This commit is contained in:
parent
c478fe2047
commit
7ff8c80e25
|
@ -920,6 +920,7 @@ pub(crate) struct BankFieldsToDeserialize {
|
|||
pub(crate) stakes: Stakes,
|
||||
pub(crate) epoch_stakes: HashMap<Epoch, EpochStakes>,
|
||||
pub(crate) is_delta: bool,
|
||||
pub(crate) accounts_data_len: u64,
|
||||
}
|
||||
|
||||
// Bank's common fields shared by all supported snapshot versions for serialization.
|
||||
|
@ -958,6 +959,7 @@ pub(crate) struct BankFieldsToSerialize<'a> {
|
|||
pub(crate) stakes: &'a StakesCache,
|
||||
pub(crate) epoch_stakes: &'a HashMap<Epoch, EpochStakes>,
|
||||
pub(crate) is_delta: bool,
|
||||
pub(crate) accounts_data_len: u64,
|
||||
}
|
||||
|
||||
// Can't derive PartialEq because RwLock doesn't implement PartialEq
|
||||
|
@ -2047,6 +2049,20 @@ impl Bank {
|
|||
bank.fee_calculator
|
||||
);
|
||||
}
|
||||
|
||||
datapoint_info!(
|
||||
"bank-new-from-fields",
|
||||
(
|
||||
"accounts_data_len-from-snapshot",
|
||||
fields.accounts_data_len as i64,
|
||||
i64
|
||||
),
|
||||
(
|
||||
"accounts_data_len-from-generate_index",
|
||||
accounts_data_len as i64,
|
||||
i64
|
||||
),
|
||||
);
|
||||
bank
|
||||
}
|
||||
|
||||
|
@ -2086,6 +2102,7 @@ impl Bank {
|
|||
stakes: &self.stakes_cache,
|
||||
epoch_stakes: &self.epoch_stakes,
|
||||
is_delta: self.is_delta.load(Relaxed),
|
||||
accounts_data_len: self.load_accounts_data_len(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,7 @@ struct DeserializableVersionedBank {
|
|||
ns_per_slot: u128,
|
||||
genesis_creation_time: UnixTimestamp,
|
||||
slots_per_year: f64,
|
||||
#[allow(dead_code)]
|
||||
unused: u64,
|
||||
accounts_data_len: u64,
|
||||
slot: Slot,
|
||||
epoch: Epoch,
|
||||
block_height: u64,
|
||||
|
@ -78,6 +77,7 @@ impl From<DeserializableVersionedBank> for BankFieldsToDeserialize {
|
|||
ns_per_slot: dvb.ns_per_slot,
|
||||
genesis_creation_time: dvb.genesis_creation_time,
|
||||
slots_per_year: dvb.slots_per_year,
|
||||
accounts_data_len: dvb.accounts_data_len,
|
||||
slot: dvb.slot,
|
||||
epoch: dvb.epoch,
|
||||
block_height: dvb.block_height,
|
||||
|
@ -116,7 +116,7 @@ struct SerializableVersionedBank<'a> {
|
|||
ns_per_slot: u128,
|
||||
genesis_creation_time: UnixTimestamp,
|
||||
slots_per_year: f64,
|
||||
unused: u64,
|
||||
accounts_data_len: u64,
|
||||
slot: Slot,
|
||||
epoch: Epoch,
|
||||
block_height: u64,
|
||||
|
@ -153,7 +153,7 @@ impl<'a> From<crate::bank::BankFieldsToSerialize<'a>> for SerializableVersionedB
|
|||
ns_per_slot: rhs.ns_per_slot,
|
||||
genesis_creation_time: rhs.genesis_creation_time,
|
||||
slots_per_year: rhs.slots_per_year,
|
||||
unused: u64::default(),
|
||||
accounts_data_len: rhs.accounts_data_len,
|
||||
slot: rhs.slot,
|
||||
epoch: rhs.epoch,
|
||||
block_height: rhs.block_height,
|
||||
|
|
|
@ -305,7 +305,7 @@ mod test_bank_serialize {
|
|||
|
||||
// This some what long test harness is required to freeze the ABI of
|
||||
// Bank's serialization due to versioned nature
|
||||
#[frozen_abi(digest = "4TqK4bCbL76s9mf1gbcRVSQUgtSe68wDCk3jTwoQzr6R")]
|
||||
#[frozen_abi(digest = "ERbJJzaQD39td9tiE4FPAud374S2Hvk6pvsxejm6quWf")]
|
||||
#[derive(Serialize, AbiExample)]
|
||||
pub struct BankAbiTestWrapperNewer {
|
||||
#[serde(serialize_with = "wrapper_newer")]
|
||||
|
|
Loading…
Reference in New Issue