← Back to Pull requests

fix(l1): apply RocksDB max_bytes_for_level_base on state CFs #7113

Open
unknown opened this pull request with 181 lines diff across 2 files
View on GitHub
unknown unknown commented on Aug 05, 2026 18:00 UTC
Author

Closes #7096

Summary
open_cf_descriptors only applies DBOptions from the top-level Options. CF setters on that object never reach any column family, so max_bytes_for_level_base(2GB) was a no-op and every CF kept RocksDB’s 256 MiB default. State CFs (large memtables / L0) were especially exposed to excess compaction write amp.

This change:

  • sets max_bytes_for_level_base(2GB) on the four state CFs (account_trie_nodes, storage_trie_nodes, account_flatkeyvalue, storage_flatkeyvalue)

  • removes the ineffective CF options from DB-level opts

  • leaves real DBOptions unchanged
  • Benchmarking
    A/B tooling is on perf/rocksdb-level-base-bench (stacked on this fix): tunable --rocksdb.max-bytes-for-level-base, compaction settle after import-bench, and state-CF rocksdb.cfstats dump. Primary metric is Sum W-Amp / Write(GB).

    Compare 256 MiB vs 2 GiB vs 4 GiB on a frozen DB with a long chain.rlp (≥5k–10k blocks), fresh copy per run.

    I could not run that A/B locally (no frozen bench DB; machine too small to sync one). I smoke-tested the tooling on a 30-block perf-ci import: flag, settle, and cfstats dump all worked. RocksDB unit tests pass.

    Test plan

  • cargo test -p ethrex-storage --features rocksdb -- backend::rocksdb::tests

  • import-bench A/B on frozen DB via perf/rocksdb-level-base-bench
  • Diff: 181 lines (+135 / -46) across 2 files Reviewer: ElFantasma Review duration: 106341m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.43) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 181 lines diff across 2 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.311
    Real PR Conversation Timeline
    1 comments
    "Review active on #7113"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.6% (MEDIUM) · Higher = larger blast radius
    42.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.5% · Safe to merge
    23.5%