Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

(WIP) Prototype of the tiered accounts storage #30626

Closed
wants to merge 1 commit into from

Conversation

yhchiang-sol
Copy link
Contributor

This is the WIP prototype of tiered accounts storage.

@yhchiang-sol yhchiang-sol marked this pull request as draft March 7, 2023 05:10
@yhchiang-sol yhchiang-sol force-pushed the tiered-storage branch 5 times, most recently from 886f917 to 6716225 Compare March 17, 2023 18:52
@yhchiang-sol yhchiang-sol force-pushed the tiered-storage branch 3 times, most recently from 37ce4ba to fbada9a Compare March 21, 2023 07:11
@yhchiang-sol yhchiang-sol force-pushed the tiered-storage branch 11 times, most recently from 529a7d0 to 5efd2db Compare April 2, 2023 23:54
@nickfrosty
Copy link
Contributor

In your proposal's doc, please correct the front matter to allow the docs to generate in the future:

---
title: Tiered Accounts DB Storage
---

@yhchiang-sol yhchiang-sol force-pushed the tiered-storage branch 6 times, most recently from c91d56a to 9a3257d Compare April 5, 2023 09:21
Comment on lines +88 to +228
account.data(),
account.owner(),
account.executable(),
pubkey,
hash,
write_version,
&mut cursor,
&mut footer,
&mut account_metas,
&mut account_pubkeys,
&mut owners_table,
data_block_writer,
&mut buffered_account_metas,
&mut buffered_account_pubkeys,
&mut dummy_hash,
&mut account_index_entries,
)
.unwrap();
} else {
data_block_writer = self
.write_single_account(
0, // lamports
u64::MAX, // rent_epoch,
&default_data,
&default_pubkey,
false, // executable
pubkey,
hash,
write_version,
&mut cursor,
&mut footer,
&mut account_metas,
&mut account_pubkeys,
&mut owners_table,
data_block_writer,
&mut buffered_account_metas,
&mut buffered_account_pubkeys,
&mut dummy_hash,
&mut account_index_entries,
)
.unwrap();
}
}

// Persist the last block if any
if buffered_account_metas.len() > 0 {
self.flush_account_block(
&mut cursor,
&mut footer,
&mut account_metas,
&mut account_pubkeys,
&mut buffered_account_metas,
&mut buffered_account_pubkeys,
data_block_writer,
)
.ok()?;
}

assert_eq!(buffered_account_metas.len(), 0);
assert_eq!(buffered_account_pubkeys.len(), 0);
assert_eq!(footer.account_entry_count, account_metas.len() as u32);

self.write_account_pubkeys_block(&mut cursor, &mut footer, &account_index_entries)
.ok()?;

self.write_owners_block(&mut cursor, &mut footer, &owners_table.owners_vec)
.ok()?;

footer.write_footer_block(&self.storage).ok()?;

assert_eq!(account_metas.len(), account_pubkeys.len());
assert_eq!(account_metas.len(), len - skip);

let mut stored_accounts_info: Vec<StoredAccountInfo> = Vec::with_capacity(len);
for _ in skip..len {
stored_accounts_info.push(StoredAccountInfo { offset: 0, size: 0 });
}
for i in 0..account_metas.len() {
let index = input_pubkey_map.get(&account_pubkeys[i]).unwrap();

// of ALIGN_BOUNDARY_OFFSET, while cold storage actually talks about index
// instead of offset.
stored_accounts_info[*index].offset = i * ALIGN_BOUNDARY_OFFSET;
stored_accounts_info[*index].size = W::stored_size(&footer, &account_metas, i);
}
match footer.account_meta_format {
AccountMetaFormat::Hot => info!(
"[Hot] append_accounts successfully completed. Footer: {:?}",
footer
),
/*
AccountMetaFormat::Cold => info!(
"[Cold] append_accounts successfully completed. Footer: {:?}",
footer
),
*/
}

Some(stored_accounts_info)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Aug 10, 2023
@yhchiang-sol yhchiang-sol added work in progress This isn't quite right yet and removed stale [bot only] Added to stale content; results in auto-close after a week. labels Aug 13, 2023
wen-coding pushed a commit to wen-coding/solana that referenced this pull request Aug 15, 2023
#### Summary of Changes
This PR introduces HotAccountMeta, the storage and in-memory struct of
the metadata struct for a hot account.

#### Test Plan
Unit tests are included in this PR.
Tested in mnb w/ the prototype implementation of the tiered account storage (solana-labs#30626)
wen-coding pushed a commit to wen-coding/solana that referenced this pull request Aug 15, 2023
#### Summary of Changes
This PR introduces HotAccountMeta, the storage and in-memory struct of
the metadata struct for a hot account.

#### Test Plan
Unit tests are included in this PR.
Tested in mnb w/ the prototype implementation of the tiered account storage (solana-labs#30626)
@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Aug 28, 2023
@github-actions github-actions bot closed this Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale [bot only] Added to stale content; results in auto-close after a week. work in progress This isn't quite right yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants