From 51c0649af8cce3066e499cab1a47a8d1be6c6e6c Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang <93241502+yhchiang-sol@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:17:24 -0800 Subject: [PATCH] [TieredStorage] Use RENT_EXEMPT_RENT_EPOCH in HotStorageWriter (#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. --- accounts-db/src/tiered_storage/hot.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts-db/src/tiered_storage/hot.rs b/accounts-db/src/tiered_storage/hot.rs index 8652b0b2aa..f87b1c2c25 100644 --- a/accounts-db/src/tiered_storage/hot.rs +++ b/accounts-db/src/tiered_storage/hot.rs @@ -5,6 +5,7 @@ use { account_storage::meta::StoredAccountMeta, accounts_file::MatchAccountOwnerError, accounts_hash::AccountHash, + rent_collector::RENT_EXEMPT_RENT_EPOCH, tiered_storage::{ byte_block, file::TieredStorageFile, @@ -562,7 +563,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), ) }) @@ -606,7 +607,6 @@ pub mod tests { super::*, crate::{ account_storage::meta::StoredMeta, - rent_collector::RENT_EXEMPT_RENT_EPOCH, tiered_storage::{ byte_block::ByteBlockWriter, file::TieredStorageFile,