-
Notifications
You must be signed in to change notification settings - Fork 118
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
Limit Accepted Block Cache + Store BlockID Index On-Disk #558
Conversation
return err | ||
} | ||
if err := batch.Put(PrefixBlockHeightKey(blk.Height()), blk.Bytes()); err != nil { | ||
if err := batch.Put(PrefixBlockIDHeightKey(blk.ID()), bigEndianHeight); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to store this on-disk now so that we can service historical Get
requests. We make this tradeoff so that we can avoid db compaction (from storing blocks all over disk).
return err | ||
} | ||
blkID := blk.ID() | ||
if err := batch.Put(PrefixBlockHeightIDKey(blk.Height()), blkID[:]); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We store a height lookup to avoid pulling entire blocks from disk to service historical queries.
Resolves: #475
We purposely store blocks separately from block metadata to make block shuffling on-disk less onerous (should be properly fixed with #553).
This should make implementing archival-required features much easier.