go-ethereum/cmd
Emualliug Tellab 2ee9408be5 trie/archiver: streaming archival + pathdb journal consistency (#567)
* trie/archiver: streaming subtree archival to fix OOM

Replace the recursive approach that loaded the entire trie into memory
with a streaming NodeIterator-based approach:

- processTrie now uses NodeIterator to walk the trie node-by-node
- probeHeight reads nodes from raw DB, computes height bounded at 3,
  and discards decoded nodes immediately (no in-memory trie buildup)
- collectSubtree only materializes the bounded height-3 subtree being
  archived (at most ~4096 nodes)
- Memory usage: O(iterator_stack) + O(current_subtree) instead of
  O(entire_trie)

This fixes OOM kills on large storage tries (e.g. contracts with
millions of storage slots) where the previous approach would load
all nodes and subtreeInfo into memory before archiving any of them.

* cmd/geth: flush diff layers before archiving, re-journal after

Instead of deleting the pathdb journal after archive generation (which
breaks the chain head and prevents block imports), properly integrate
with pathdb:

1. Open triedb with pathdb support (not just raw KV)
2. Disable state history freezer (avoid append gaps)
3. Flush all diff layers to disk via Commit() before archiving
4. After archiving, re-journal the pathdb state (disk layer only)

This ensures geth can restart cleanly after archiving and continue
importing blocks without 'unknown ancestor' errors.

* trie: add resurrection timing and depth metrics to expired node resolution

* Update trie/archiver.go

---------

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
2026-06-11 13:02:04 +02:00
..
abidump all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
abigen cmd/abigen: respect --v2=false (#34943) 2026-05-12 09:02:40 -04:00
blsync beacon/blsync: add checkpoint import/export file feature (#31469) 2025-04-03 16:04:11 +02:00
devp2p cmd/devp2p: swap want and got (#35125) 2026-06-08 12:06:16 -05:00
era internal/era: update to latest ere spec (#34896) 2026-06-03 11:52:10 +02:00
ethkey cmd: fix some typos in readmes (#29405) 2024-04-11 14:06:49 +03:00
evm trie/bintrie: record inserted leaves for t8n (#34843) 2026-05-28 17:06:47 +02:00
fetchpayload cmd/fetchpayload: add payload-building utility (#33919) 2026-03-11 16:18:42 +01:00
geth trie/archiver: streaming archival + pathdb journal consistency (#567) 2026-06-11 13:02:04 +02:00
keeper core/state/snapshot: snapshot generation shutdown race condition (#33540) 2026-06-04 21:22:58 -05:00
rlpdump build: update to golangci-lint 1.61.0 (#30587) 2024-10-14 19:25:22 +02:00
utils cmd/utils: validates trimmed string but parses the untrimmed one (#35116) 2026-06-08 13:25:32 -05:00
workload core/history: refactor pruning configuration (#34036) 2026-03-18 13:54:29 +01:00