Skip to content

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

Open
NikhilSharmaWe wants to merge 1 commit into
lambdaclass:mainfrom
NikhilSharmaWe:fix/rocksdb-cf-max-bytes-for-level-base
Open

fix(l1): apply RocksDB max_bytes_for_level_base on state CFs#7113
NikhilSharmaWe wants to merge 1 commit into
lambdaclass:mainfrom
NikhilSharmaWe:fix/rocksdb-cf-max-bytes-for-level-base

Conversation

@NikhilSharmaWe

@NikhilSharmaWe NikhilSharmaWe commented Aug 5, 2026

Copy link
Copy Markdown

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

Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
@NikhilSharmaWe
NikhilSharmaWe requested a review from a team as a code owner August 5, 2026 18:00
@github-actions github-actions Bot added the external-contributor PR opened by a contributor outside the team label Aug 5, 2026
@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown

Greptile Summary

The PR moves the 2 GiB RocksDB base-level target from ineffective top-level options to the descriptors for all four state column families.

  • Removes column-family setters that were incorrectly applied to the database-level options.
  • Applies max_bytes_for_level_base to account/storage trie-node and flat-key-value column families.
  • Preserves database-level write-buffer, WAL, and I/O settings.

Confidence Score: 5/5

The PR appears safe to merge, with all four intended state column families receiving the corrected RocksDB option.

The descriptor branches cover both account and storage variants of the trie-node and flat-key-value state column families, and no concrete regression from removing the ineffective top-level setters remains.

Important Files Changed

Filename Overview
crates/storage/backend/rocksdb.rs Correctly applies the base-level target to all four intended state column-family descriptors while removing ineffective top-level column-family settings.

Reviews (1): Last reviewed commit: "fix(l1): apply RocksDB max_bytes_for_lev..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor PR opened by a contributor outside the team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RocksDB: column-family options set on the DB-level Options never reach any CF (max_bytes_for_level_base 2 GB is a no-op)

1 participant