Skip to content

fix(node): create hot storage tables before first read in prebuild#122

Closed
rswanson wants to merge 3 commits intodevelopfrom
fix/handle-fresh-mdbx-in-prebuild
Closed

fix(node): create hot storage tables before first read in prebuild#122
rswanson wants to merge 3 commits intodevelopfrom
fix/handle-fresh-mdbx-in-prebuild

Conversation

@rswanson
Copy link
Copy Markdown
Member

@rswanson rswanson commented Mar 26, 2026

Summary

  • Fixes three issues causing signet-sidecar crash-loops in Kubernetes
  • Fresh MDBX database crash: On a fresh MDBX database, named tables (e.g. Headers) do not exist until explicitly created via a write transaction with the MDBX_CREATE flag. prebuild() was attempting reader.has_block(0)? using a read-only transaction, which cannot create tables — MDBX returns NOTFOUND. Adds an idempotent table creation step before the first read.
  • Cold backpressure crash: During initial sync, append_blocks treated cold storage backpressure (channel full) as a fatal error, crashing the node around block ~1000-1900. The UnifiedStorage docs explicitly state backpressure is transient and should be logged, not fatal. Changed to log and continue since hot storage is authoritative.
  • Log spam: Demoted cold backpressure log from warn to debug since it fires on every block during initial sync.

Test plan

  • cargo check -p signet-node passes
  • cargo clippy -p signet-node passes
  • cargo fmt -- --check passes
  • cargo test -p signet-node passes
  • cargo test -p signet-node-tests passes (33 integration tests)
  • Deploy to dev cluster — verified node starts, syncs past previous crash points

🤖 Generated with Claude Code

On a fresh MDBX database, named tables do not exist until explicitly
created in a write transaction. The prebuild() method was attempting
to read from the "Headers" table via a read-only transaction, which
cannot create tables, causing MDBX_NOTFOUND ("no matching key/data
pair found") to propagate as a fatal error.

This adds an initialization step that creates all standard hot storage
tables in a write transaction before any reads. The create operation
is idempotent, so it is safe on existing databases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rswanson rswanson requested a review from a team as a code owner March 26, 2026 22:32
rswanson and others added 2 commits March 26, 2026 18:52
During initial sync or rapid block processing, the cold storage
channel can fill up faster than the PostgreSQL backend can drain it.
The UnifiedStorage docs explicitly state that backpressure is transient
and should be logged, not treated as fatal — hot storage is authoritative
and cold will catch up.

Change append_blocks error handling to log cold storage errors as
warnings instead of crashing the node.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
During initial sync this fires on every block, flooding the logs.
Demote to debug since it's expected transient behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rswanson rswanson self-assigned this Mar 26, 2026
Copy link
Copy Markdown
Member

@prestwich prestwich left a comment

Choose a reason for hiding this comment

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

keep this deployed while we push upstream fix

// named tables must be created in a write transaction before
// read-only transactions can open them.
{
let writer = storage.hot().writer()?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should address this in the storage crate

@prestwich
Copy link
Copy Markdown
Member

superseded by release of signet storage @0.6.8

@prestwich prestwich closed this Mar 27, 2026
@rswanson rswanson reopened this Mar 27, 2026
@rswanson rswanson closed this Mar 27, 2026
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