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

Store linear blocks in freezer db #5905

Draft
wants to merge 4 commits into
base: unstable
Choose a base branch
from

Conversation

dapplion
Copy link
Collaborator

@dapplion dapplion commented Jun 10, 2024

Issue Addressed

Part of tree-states Disk Edition ™️

Currently Lighthouse stores blocks by root in the same bucket as unfinalized blocks. Storing finalized blocks in a separate bucket allows faster reads of sequential slot ranges. It also simplifies pruning logic and can allow us to drop the head-tracker which has been a source of bugs in the past:

Proposed Changes

  • Given a block ID read from either hot or cold DB based on a slot hint
  • On finalization move finalized blocks from hot DB to the freezer on a new column BeaconBlockFrozen and compress them
  • Migrate existing blocks to freezer

dapplion and others added 2 commits June 10, 2024 14:58
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
let block = store
.get_hot_blinded_block(&block_root)?
.ok_or(HotColdDBError::MissingBlockToFreeze(block_root))?;
store.blinded_block_as_cold_kv_store_ops(&block_root, &block, &mut cold_db_ops)?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does the state_root_iter yield the same block_root more than once for skipped slots? If yes we are doing extra work here

upgrade_freezer_database::<T>(&db, &log)?;

// No hot DB changes
return Ok(vec![]);
Copy link
Collaborator Author

@dapplion dapplion Jun 10, 2024

Choose a reason for hiding this comment

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

@michaelsproul thoughts on migrating all finalized blocks? If we just delete that's going to be a lot of bandwidth on the entire network to backfill. However, migrating all blocks will take a while. Are DB migrations blocking the start routine of Lighthouse?

@michaelsproul michaelsproul added optimization Something to make Lighthouse run more efficiently. database tree-states Upcoming state and database overhaul labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database optimization Something to make Lighthouse run more efficiently. tree-states Upcoming state and database overhaul
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants