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

fix: do not truncate blocks to persist #9986

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented Aug 1, 2024

Closes #9978

@github-actions github-actions bot added the C-perf A change motivated by improving speed, memory usage or disk footprint label Aug 1, 2024
Copy link
Member

@rkrasiuk rkrasiuk left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +769 to +771
/// Returns a batch of consecutive canonical blocks to persist in the range
/// `(last_persisted_number .. canonical_head - threshold]` . The expected
/// order is oldest -> newest.
Copy link
Collaborator

Choose a reason for hiding this comment

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

sg!

Comment on lines 783 to 785
if block.block.number <= last_persisted_number {
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this should actually be enforced by the tree invariants, but better be safe here

Comment on lines +787 to +789
if block.block.number <= target_number {
blocks_to_persist.push(block.clone());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will work because we have a guarantee that canonical head always has its parent blocks

/// oldest -> newest.
/// Returns a batch of consecutive canonical blocks to persist in the range
/// `(last_persisted_number .. canonical_head - threshold]` . The expected
/// order is oldest -> newest.
fn get_canonical_blocks_to_persist(&self) -> Vec<ExecutedBlock> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could this return an empty vec?
if so we likely should add a sanity check before we send that vec to the persistence task

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, added here 45fbe9e

@fgimenez fgimenez enabled auto-merge August 1, 2024 14:00
@fgimenez fgimenez disabled auto-merge August 1, 2024 15:26
@fgimenez fgimenez added this pull request to the merge queue Aug 1, 2024
Merged via the queue into main with commit 09d5cb5 Aug 1, 2024
32 checks passed
@fgimenez fgimenez deleted the fgimenez/do-not-truncate-blocks-to-persist branch August 1, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dont truncate blocks to persist
3 participants