Skip to content

triedb/pathdb: refactor state history write#32497

Merged
rjl493456442 merged 2 commits intoethereum:masterfrom
rjl493456442:refactor-state-write
Aug 26, 2025
Merged

triedb/pathdb: refactor state history write#32497
rjl493456442 merged 2 commits intoethereum:masterfrom
rjl493456442:refactor-state-write

Conversation

@rjl493456442
Copy link
Copy Markdown
Member

This pull request refactors the internal implementation in path database a bit,
specifically:

  • purge the state index data in batch
  • simplify the logic of state history construction and index, make it more readable

})
// Block until the frozen buffer is fully flushed out if the async flushing
// is not allowed, or if the oldest history surpasses the persisted state ID.
if dl.db.config.NoAsyncFlush || persistedID < oldest {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Originally, we need to explicitly wait until the buffer is fully flushed before the history tail truncation, if after truncation, the new tail history ID will be greater than the persistent ID

Now it's no longer required, as we skip the tail truncation in this case for simplicity.

Copy link
Copy Markdown
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

LGTM, afaict theres no functional change

@rjl493456442 rjl493456442 added this to the 1.16.3 milestone Aug 26, 2025
@rjl493456442 rjl493456442 merged commit 95ab643 into ethereum:master Aug 26, 2025
5 of 6 checks passed
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
This pull request refactors the internal implementation in path database
a bit, specifically:

- purge the state index data in batch
- simplify the logic of state history construction and index, make it more readable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants