-
Notifications
You must be signed in to change notification settings - Fork 149
Implement snapshots cache in aristo database #3760
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
Changes from all commits
44be984
fe85e36
a4e9a7f
e2aab82
3dfd81a
05c9306
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,14 +126,6 @@ proc replayBlock(fc: ForkedChainRef; | |
| parentFrame = parent.txFrame | ||
| txFrame = parentFrame.txFrameBegin() | ||
|
|
||
| # Checkpoint creates a snapshot of ancestor changes in txFrame - it is an | ||
| # expensive operation, specially when creating a new branch (ie when blk | ||
| # is being applied to a block that is currently not a head). | ||
| # Create the snapshot before processing the block so that any vertexes in snapshots | ||
| # from lower levels than the baseTxFrame are removed from the snapshot before running | ||
| # the stateroot computation. | ||
| parentFrame.checkpoint(parent.blk.header.number, skipSnapshot = false) | ||
|
|
||
| # Set finalized to true in order to skip the stateroot check when replaying the | ||
| # block because the blocks should have already been checked previously during | ||
| # the initial block execution. | ||
|
|
@@ -143,6 +135,11 @@ proc replayBlock(fc: ForkedChainRef; | |
|
|
||
| fc.writeBaggage(blk.blk, blk.hash, txFrame, receipts) | ||
|
|
||
| # Checkpoint creates a snapshot of ancestor changes in txFrame - it is an | ||
| # expensive operation, specially when creating a new branch (ie when blk | ||
| # is being applied to a block that is currently not a head). | ||
| parentFrame.checkpoint(blk.header.number, skipSnapshot = false) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes should be |
||
|
|
||
| blk.txFrame = txFrame | ||
| blk.receipts = move(receipts) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,7 @@ proc initInstance*(db: AristoDbRef): Result[void, AristoError] = | |
| db.txRef = AristoTxRef(db: db, vTop: vTop, snapshot: Snapshot(level: Opt.some(0))) | ||
| db.accLeaves = LruCache[Hash32, AccLeafRef].init(ACC_LRU_SIZE) | ||
| db.stoLeaves = LruCache[Hash32, StoLeafRef].init(ACC_LRU_SIZE) | ||
| db.maxSnapshots = 10 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be made configurable if/when needed. |
||
| ok() | ||
|
|
||
| proc finish*(db: AristoDbRef; eradicate = false) = | ||
|
|
||
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.
..and here..