Skip to content

Commit

Permalink
[TieredStorage] Use RENT_EXEMPT_RENT_EPOCH in HotStorageWriter (solan…
Browse files Browse the repository at this point in the history
…a-labs#34950)

#### Problem
In HotStorageWriter::write_accounts, it skips storing rent-epoch when
the rent-epoch equals Epoch::MAX.  While the value is correct, it is
more suitable to use RENT_EXEMPT_RENT_EPOCH instead as the
goal here is to save bytes for rent-exempt accounts.

#### Summary of Changes
Replace Epoch::MAX by RENT_EXEMPT_RENT_EPOCH when checking
whether to skip storing rent-epoch in HotStorageWriter.
  • Loading branch information
yhchiang-sol committed Feb 13, 2024
1 parent b0df5f1 commit 3d4c8e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions accounts-db/src/tiered_storage/hot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use {
account_storage::meta::StoredAccountMeta,
accounts_file::MatchAccountOwnerError,
accounts_hash::AccountHash,
rent_collector::RENT_EXEMPT_RENT_EPOCH,
tiered_storage::{
byte_block,
file::TieredStorageFile,
Expand Down Expand Up @@ -554,7 +555,7 @@ impl HotStorageWriter {
acc.data(),
acc.executable(),
// only persist rent_epoch for those non-rent-exempt accounts
(acc.rent_epoch() != Epoch::MAX).then_some(acc.rent_epoch()),
(acc.rent_epoch() != RENT_EXEMPT_RENT_EPOCH).then_some(acc.rent_epoch()),
Some(*account_hash),
)
})
Expand Down Expand Up @@ -598,7 +599,6 @@ pub mod tests {
super::*,
crate::{
account_storage::meta::StoredMeta,
rent_collector::RENT_EXEMPT_RENT_EPOCH,
tiered_storage::{
byte_block::ByteBlockWriter,
file::TieredStorageFile,
Expand Down

0 comments on commit 3d4c8e8

Please sign in to comment.