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

core/trie: persist TrieJournal to journal file instead of kv database #95

Merged
merged 9 commits into from
Jun 12, 2024

Conversation

sysvm
Copy link
Contributor

@sysvm sysvm commented Apr 24, 2024

Description

This PR provides another way to persist TrieJournal by write it into a log file instead of a kv database.

Use --journalFile flag to enable/disable the journal file feature.

Rationale

Persisting TrieJournal to KV database will cause problems below

Changes:

Data Format

Journal Version
Disk Root
Disk Layer

  • Root
  • State ID
  • Buffer Nodes
  • Layer Checksum

Diff Layer

  • Root
  • Block
  • Trie Nodes
  • Journal Accounts
  • Layer Checksum

Journal Path: geth/chaindata/ancient/state.journal
Checksum: SHA256

Performance test

Scenario: Using TestJournal, each layer has 4K and 8K account operations.

WriteJournal LoadJournal Dirty State Size
New Journal WAL 6.149s 12.496s 1.19GiB
Old KVDB 6.341s 12.340s 1.21GiB
New Journal WAL 11.724s 20.525s 1.85GiB
Old KVDB 11.107s 19.415s 1.85GiB

Conclusion: The use of Journal WAL and storing trieJournalKey directly into kvdb results in nearly identical WAL write times during shutdown and WAL read/parsing times during startup.

@joeylichang joeylichang added the wip work in process label Apr 24, 2024
owen-reorg pushed a commit to owen-reorg/op-geth that referenced this pull request Apr 25, 2024
core/types: Include overhead in the L1GasUsed for receipts.
@sysvm sysvm force-pushed the feat-journalfile branch from a935b92 to 5ddc40d Compare May 13, 2024 06:31
@sysvm sysvm force-pushed the feat-journalfile branch from dc77934 to 0466e32 Compare May 28, 2024 14:41
@sysvm sysvm added R4R Ready for review and removed wip work in process labels May 28, 2024
@owen-reorg owen-reorg requested a review from krish-nr June 11, 2024 02:42
fynnss
fynnss previously approved these changes Jun 11, 2024
@owen-reorg owen-reorg merged commit b49ec60 into bnb-chain:develop Jun 12, 2024
1 check passed
@sysvm sysvm deleted the feat-journalfile branch June 12, 2024 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R4R Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants