Skip to content

feat(db): add flag to disable RocksDB auto compactions#3953

Merged
jolestar merged 2 commits into
mainfrom
feat/disable-rocksdb-auto-compactions
Feb 22, 2026
Merged

feat(db): add flag to disable RocksDB auto compactions#3953
jolestar merged 2 commits into
mainfrom
feat/disable-rocksdb-auto-compactions

Conversation

@jolestar

@jolestar jolestar commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a new node startup flag: --rocksdb-disable-auto-compactions
  • wire the flag through StoreConfig -> RocksdbConfig
  • apply disable_auto_compactions to all RocksDB column families when opening DB

Why

  • main node background compaction can interfere with long-running snapshot tasks
  • this allows operators to temporarily disable auto compaction on the main DB while snapshot/export runs

Testing

  • cargo check -p moveos-config

- 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
Copilot AI review requested due to automatic review settings February 20, 2026 03:17
@vercel

vercel Bot commented Feb 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rooch-portal-v2.1 Ready Ready Preview, Comment Feb 21, 2026 0:39am
test-portal Ready Ready Preview, Comment Feb 21, 2026 0:39am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
rooch Ignored Ignored Preview Feb 21, 2026 0:39am

Request Review

@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-compactions CLI/config setting to control RocksDB auto-compactions.
  • Wire the setting through rooch-configmoveos-configraw-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);

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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,

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

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

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).

Suggested change
long,
long,
num_args(0..=1),
default_missing_value = "true",

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
@jolestar jolestar merged commit c2e0a0e into main Feb 22, 2026
29 checks passed
@jolestar jolestar deleted the feat/disable-rocksdb-auto-compactions branch February 22, 2026 00:51
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