feat(db): add flag to disable RocksDB auto compactions#3953
Conversation
- add --rocksdb-disable-auto-compactions CLI/config field - propagate flag into RocksdbConfig defaults and StoreConfig mapping - apply disable_auto_compactions to all RocksDB column families at open time
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR introduces a node startup configuration flag to disable RocksDB auto-compactions, wiring it through config and applying it when opening RocksDB column families to reduce background I/O during long-running snapshot/export operations.
Changes:
- Add a
rocksdb-disable-auto-compactionsCLI/config setting to control RocksDB auto-compactions. - Wire the setting through
rooch-config→moveos-config→raw-store. - Apply the setting to all RocksDB column families during DB open via per-CF options.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| moveos/raw-store/src/rocks/mod.rs | Applies disable_auto_compactions to CF options during DB open. |
| moveos/moveos-config/src/store_config.rs | Adds disable_auto_compactions: bool to RocksdbConfig and defaults it to false. |
| crates/rooch-config/src/store_config.rs | Adds CLI/serde exposure and maps it into moveos_config::RocksdbConfig. |
| // Enable BlobDB garbage collection to reclaim space of obsolete blob records | ||
| cf_opts.set_enable_blob_gc(true); | ||
| cf_opts.set_blob_compression_type(DBCompressionType::Lz4); | ||
| cf_opts.set_disable_auto_compactions(rocksdb_config.disable_auto_compactions); |
There was a problem hiding this comment.
With disable_auto_compactions now configurable at DB open time, code paths that temporarily toggle this option should restore the previous value rather than unconditionally re-enabling it. For example, NodeDBStore::aggressive_compact currently sets disable_auto_compactions back to "false" in a Drop guard, which would override an operator that started the node with auto compactions disabled. Consider capturing the current setting (or using rocksdb_config.disable_auto_compactions as the baseline) and restoring that value instead.
There was a problem hiding this comment.
Addressed. NodeDBStore::aggressive_compact now captures the current rocksdb.is-auto-compactions-enabled state and restores that prior state in the RAII guard, instead of unconditionally forcing disable_auto_compactions=false on drop.
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[clap( | ||
| name = "rocksdb-disable-auto-compactions", | ||
| long, |
There was a problem hiding this comment.
disable_auto_compactions is an Option<bool> but is declared as a --rocksdb-disable-auto-compactions flag. In clap derive, Option<bool> typically parses as an option that requires an explicit value (e.g. --rocksdb-disable-auto-compactions true), which doesn’t match the help text and differs from other boolean flags here (e.g. enable_statistics). Consider making this a plain bool switch, or adjusting the clap arg settings so --rocksdb-disable-auto-compactions without a value sets it to true (while still allowing =false when needed).
| long, | |
| long, | |
| num_args(0..=1), | |
| default_missing_value = "true", |
There was a problem hiding this comment.
Good catch. I changed StoreConfig.disable_auto_compactions to a plain bool flag, so --rocksdb-disable-auto-compactions now behaves as a normal switch (no explicit value required). This aligns with the existing enable_statistics style.
- make --rocksdb-disable-auto-compactions a bool flag in StoreConfig - restore previous auto-compaction state after aggressive_compact instead of forcing false
Summary
--rocksdb-disable-auto-compactionsStoreConfig -> RocksdbConfigdisable_auto_compactionsto all RocksDB column families when opening DBWhy
Testing
cargo check -p moveos-config