feat(storage): add startup validation for RocksDB CLI flags#21192
Closed
feat(storage): add startup validation for RocksDB CLI flags#21192
Conversation
Introduces RocksDbArgs struct with --rocksdb.tx-hash, --rocksdb.storages-history, and --rocksdb.account-history flags for controlling which tables route to RocksDB. These flags are genesis-initialization-only (changing later requires re-sync).
- Add test for bare flag without value (should require a value) - Add test for space-separated value syntax
- Add rocksdb field to NodeConfig - Update init_genesis to apply RocksDB settings on top of static files settings - All struct initializers and Clone impl updated
31acba8 to
6b6eb83
Compare
Wire RocksDbArgs through NodeCommand to enable CLI flags to be passed through to NodeConfig. Also fix clippy warnings for doc_markdown (backticks around RocksDB) and missing_const_for_fn.
6b6eb83 to
eadabff
Compare
eadabff to
5169575
Compare
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Consolidate 12 tests down to 3 essential ones covering defaults, parsing, and settings application.
- If any --rocksdb.* flag is set to true, all RocksDB tables are enabled - Explicit --rocksdb.<table>=false overrides can disable specific tables - Logs startup message when grouped behavior triggers - DRY'd doc comments (genesis-only note moved to struct level) - Added comprehensive tests for grouped enable behavior
- Add test for all-explicit-false edge case - Add test verifying non-rocksdb fields preserved - Rename parameter defaults -> settings for clarity - Extract storage_settings_with_logging() helper to DRY up with_genesis/init_genesis - Fix clippy doc warnings (backticks around RocksDB)
Validates that --rocksdb.* flags match persisted storage layout. Errors on mismatch since these are genesis-initialization-only settings.
- Add backticks around RocksDB in doc comments (clippy::doc_markdown) - Make apply_to_settings() and validate_against_persisted() const fn - Collapse nested if statements using let-chains
- Add test for matching false overrides against persisted false - Add test verifying first mismatch is reported when multiple exist - Add test for partial override matching
5169575 to
405bb65
Compare
Integrate the validate_against_persisted() method into init_genesis() so CLI overrides are validated against persisted storage settings at startup. - Add RocksDbSettingsMismatch variant to InitStorageError - Call validation after genesis initialization - Fail early if CLI flags don't match persisted settings
8ebf7fc to
3972cd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds startup validation to ensure
--rocksdb.*flags match the persisted storage layout.Behavior
Changes
validate_against_persisted()method toRocksDbArgsRocksDbSettingsMismatchErrorfor clear error messagesExample Error
PR Stack