Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TieredStorage] Rename AddressAndBlockOffsetOnly to AddressesThenOffsets #34658

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounts-db/src/tiered_storage/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ mod tests {
let expected_footer = TieredStorageFooter {
account_meta_format: AccountMetaFormat::Hot,
owners_block_format: OwnersBlockFormat::LocalIndex,
index_block_format: IndexBlockFormat::AddressAndBlockOffsetOnly,
index_block_format: IndexBlockFormat::AddressesThenOffsets,
account_block_format: AccountBlockFormat::AlignedRaw,
account_entry_count: 300,
account_meta_entry_size: 24,
Expand Down
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 @@ -29,7 +29,7 @@ pub const HOT_FORMAT: TieredStorageFormat = TieredStorageFormat {
meta_entry_size: std::mem::size_of::<HotAccountMeta>(),
account_meta_format: AccountMetaFormat::Hot,
owners_block_format: OwnersBlockFormat::LocalIndex,
index_block_format: IndexBlockFormat::AddressAndBlockOffsetOnly,
index_block_format: IndexBlockFormat::AddressesThenOffsets,
account_block_format: AccountBlockFormat::AlignedRaw,
};

Expand Down Expand Up @@ -610,7 +610,7 @@ pub mod tests {
let expected_footer = TieredStorageFooter {
account_meta_format: AccountMetaFormat::Hot,
owners_block_format: OwnersBlockFormat::LocalIndex,
index_block_format: IndexBlockFormat::AddressAndBlockOffsetOnly,
index_block_format: IndexBlockFormat::AddressesThenOffsets,
account_block_format: AccountBlockFormat::AlignedRaw,
account_entry_count: 300,
account_meta_entry_size: 16,
Expand Down
22 changes: 11 additions & 11 deletions accounts-db/src/tiered_storage/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum IndexBlockFormat {
/// and block offsets. It skips storing the size of account data by storing
/// account block entries and index block entries in the same order.
#[default]
AddressAndBlockOffsetOnly = 0,
AddressesThenOffsets = 0,
}

// Ensure there are no implicit padding bytes
Expand All @@ -63,7 +63,7 @@ impl IndexBlockFormat {
index_entries: &[AccountIndexWriterEntry<impl AccountOffset>],
) -> TieredStorageResult<usize> {
match self {
Self::AddressAndBlockOffsetOnly => {
Self::AddressesThenOffsets => {
let mut bytes_written = 0;
for index_entry in index_entries {
bytes_written += file.write_pod(index_entry.address)?;
Expand All @@ -84,7 +84,7 @@ impl IndexBlockFormat {
index_offset: IndexOffset,
) -> TieredStorageResult<&'a Pubkey> {
let offset = match self {
Self::AddressAndBlockOffsetOnly => {
Self::AddressesThenOffsets => {
debug_assert!(index_offset.0 < footer.account_entry_count);
footer.index_block_offset as usize
+ std::mem::size_of::<Pubkey>() * (index_offset.0 as usize)
Expand All @@ -111,7 +111,7 @@ impl IndexBlockFormat {
index_offset: IndexOffset,
) -> TieredStorageResult<Offset> {
let offset = match self {
Self::AddressAndBlockOffsetOnly => {
Self::AddressesThenOffsets => {
debug_assert!(index_offset.0 < footer.account_entry_count);
footer.index_block_offset as usize
+ std::mem::size_of::<Pubkey>() * footer.account_entry_count as usize
Expand All @@ -135,7 +135,7 @@ impl IndexBlockFormat {
/// Returns the size of one index entry.
pub fn entry_size<Offset: AccountOffset>(&self) -> usize {
match self {
Self::AddressAndBlockOffsetOnly => {
Self::AddressesThenOffsets => {
std::mem::size_of::<Pubkey>() + std::mem::size_of::<Offset>()
}
}
Expand Down Expand Up @@ -182,12 +182,12 @@ mod tests {

{
let file = TieredStorageFile::new_writable(&path).unwrap();
let indexer = IndexBlockFormat::AddressAndBlockOffsetOnly;
let indexer = IndexBlockFormat::AddressesThenOffsets;
let cursor = indexer.write_index_block(&file, &index_entries).unwrap();
footer.owners_block_offset = cursor as u64;
}

let indexer = IndexBlockFormat::AddressAndBlockOffsetOnly;
let indexer = IndexBlockFormat::AddressesThenOffsets;
let file = OpenOptions::new()
.read(true)
.create(false)
Expand Down Expand Up @@ -216,7 +216,7 @@ mod tests {

let footer = TieredStorageFooter {
account_entry_count: 100,
index_block_format: IndexBlockFormat::AddressAndBlockOffsetOnly,
index_block_format: IndexBlockFormat::AddressesThenOffsets,
..TieredStorageFooter::default()
};

Expand Down Expand Up @@ -249,7 +249,7 @@ mod tests {

let footer = TieredStorageFooter {
account_entry_count: 100,
index_block_format: IndexBlockFormat::AddressAndBlockOffsetOnly,
index_block_format: IndexBlockFormat::AddressesThenOffsets,
index_block_offset: 1024,
// only holds one index entry
owners_block_offset: 1024 + std::mem::size_of::<HotAccountOffset>() as u64,
Expand Down Expand Up @@ -287,7 +287,7 @@ mod tests {

let footer = TieredStorageFooter {
account_entry_count: 100,
index_block_format: IndexBlockFormat::AddressAndBlockOffsetOnly,
index_block_format: IndexBlockFormat::AddressesThenOffsets,
..TieredStorageFooter::default()
};

Expand Down Expand Up @@ -324,7 +324,7 @@ mod tests {

let footer = TieredStorageFooter {
account_entry_count: 100,
index_block_format: IndexBlockFormat::AddressAndBlockOffsetOnly,
index_block_format: IndexBlockFormat::AddressesThenOffsets,
index_block_offset: 1024,
// only holds one index entry
owners_block_offset: 1024 + std::mem::size_of::<HotAccountOffset>() as u64,
Expand Down