Skip to content

triedb/pathdb: introduce file-based state journal #32060

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jun 18, 2025

allow write trie journal into a local file instead of disk, used when the trie jounral is >= 4GB, ref gballet#546 (comment)

@jsvisa jsvisa requested a review from rjl493456442 as a code owner June 18, 2025 08:01
@rjl493456442 rjl493456442 self-assigned this Jun 18, 2025
@fjl
Copy link
Contributor

fjl commented Jun 24, 2025

The idea is good, but the path should not be configurable. We should just resolve the path in the datadir and store the file there unconditionally.

@fjl fjl removed the status:triage label Jun 24, 2025
@jsvisa jsvisa force-pushed the journal-into-file branch from 9abf10a to 516c1b3 Compare June 25, 2025 07:04
@rjl493456442
Copy link
Member

rjl493456442 commented Jun 27, 2025

This pull request is backward-compatible:

  • Upgrade from old version, the journal will be resolved from database and persist into file
  • Downgrade to old version, Geth will attempt to resolve journal from database only and drop in-memory layers if not matched

The journal directory will be $DATADIR/triedb, with $DATADIR/triedb/merkle.journal for legacy merkle trie database and $DATADIR/triedb/verkle.journal for verkle respectively.

@rjl493456442
Copy link
Member

logs:

INFO [06-27|14:17:56.460] Load database journal from file          path=/home/gary/eth-sepolia/el/geth/triedb/merkle.journal

...

INFO [06-27|14:21:04.978] Persisting dirty state                   head=5,276,356 root=b0d1cb..19ba68 layers=1551
INFO [06-27|14:21:06.556] Persisted dirty state to file            path=/home/gary/eth-sepolia/el/geth/triedb/merkle.journal size=342.21MiB elapsed=1.578s
rjl493456442
rjl493456442 previously approved these changes Jun 27, 2025
Copy link
Member

@rjl493456442 rjl493456442 left a comment

Choose a reason for hiding this comment

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

sgtm

jsvisa and others added 15 commits July 1, 2025 10:09
* all: load/dump trie disklayer into file

Signed-off-by: jsvisa <delweng@gmail.com>

* cmd: set cache.trie.journal=trie-disklayer.rlp as default

Signed-off-by: jsvisa <delweng@gmail.com>

* journal: directly write into file

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
@rjl493456442 rjl493456442 changed the title trie: write trie journal into disk Jul 1, 2025
@rjl493456442 rjl493456442 added this to the 1.16.1 milestone Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants