feat(config): remove ineffective RocksDB table setters - #50
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bd3ec32 to
50ceeba
Compare
There was a problem hiding this comment.
1 issue found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="framework/src/test/java/org/tron/core/config/ConfigurationTest.java">
<violation number="1" location="framework/src/test/java/org/tron/core/config/ConfigurationTest.java:101">
P3: assertFalse(config.hasPath("storage.dbSettings.blocksize")) can never detect a regression because that key does not exist in config.conf, reference.conf, or DbSettingsConfig. The per-database blockSize override lives under storage.properties (DbOptionOverride.blockSize), not storage.dbSettings. Drop the assertion, or if you intend to guard the removal, assert on the namespace that actually carried the option.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| Config config = Configuration.getByFileName("config.conf"); | ||
| StorageConfig.DbSettingsConfig settings = StorageConfig.fromConfig(config).getDbSettings(); | ||
|
|
||
| assertFalse(config.hasPath("storage.dbSettings.blocksize")); |
There was a problem hiding this comment.
P3: assertFalse(config.hasPath("storage.dbSettings.blocksize")) can never detect a regression because that key does not exist in config.conf, reference.conf, or DbSettingsConfig. The per-database blockSize override lives under storage.properties (DbOptionOverride.blockSize), not storage.dbSettings. Drop the assertion, or if you intend to guard the removal, assert on the namespace that actually carried the option.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At framework/src/test/java/org/tron/core/config/ConfigurationTest.java, line 101:
<comment>assertFalse(config.hasPath("storage.dbSettings.blocksize")) can never detect a regression because that key does not exist in config.conf, reference.conf, or DbSettingsConfig. The per-database blockSize override lives under storage.properties (DbOptionOverride.blockSize), not storage.dbSettings. Drop the assertion, or if you intend to guard the removal, assert on the namespace that actually carried the option.</comment>
<file context>
@@ -91,4 +92,19 @@ public void getConfigurationWhenOnlyConfFileName() {
+ Config config = Configuration.getByFileName("config.conf");
+ StorageConfig.DbSettingsConfig settings = StorageConfig.fromConfig(config).getDbSettings();
+
+ assertFalse(config.hasPath("storage.dbSettings.blocksize"));
+ assertEquals(7, settings.getLevelNumber());
+ assertEquals(256, settings.getMaxBytesForLevelBase());
</file context>
| assertFalse(config.hasPath("storage.dbSettings.blocksize")); | |
| // (remove the assertFalse on storage.dbSettings.blocksize; the key was never defined) |
There was a problem hiding this comment.
Addressed in a3bab81b05. The storage.dbSettings.blocksize entry is now retained in both config.conf and reference.conf to avoid an unnecessary configuration compatibility change. The configuration test verifies that the shipped value still resolves to 64 KiB, while the native Options test separately verifies that it is not applied to the RocksDB table factory.
2594672 to
a3bab81
Compare
Preserve the shipped RocksDB configuration and public block-size API while removing table setters that never reached the native table factory. Document that blocksize is currently ineffective and verify native behavior. Keep the existing shared cache object for separate configuration design and validation. Closes tronprotocol#6939
a3bab81 to
14922c4
Compare
What does this PR do?
Remove RocksDB block-table setters that were applied after
setTableFormatConfig()and therefore never reached the native table factory.Keep the existing
storage.dbSettings.blocksizeentries and Java API for compatibility, while documenting inreference.confthat the value is not currently applied to native RocksDB table options.Add regression tests for the shipped Options-level configuration and the effective native block-table behavior.
Why are these changes required?
setTableFormatConfig()materializes the native table factory from the Java configuration at call time. The later block-size, shared-cache, index/filter-cache, L0-pinning, and Bloom-filter setters only changed the Java object and did not affect the native factory.Moving those setters before
setTableFormatConfig()would activate several unverified settings at once. In a fixed 500-block Mainnet replay, activating the combined settings reduced throughput from 2.421 blocks/s to 1.969 and 1.680 blocks/s, while restoring the pre-change effective native behavior produced 2.418 blocks/s.This change therefore removes the ineffective setter sequence while preserving the behavior that nodes actually used before the change.
This PR has been tested by:
./gradlew :common:test --tests org.tron.common.setting.RocksDbSettingsTest./gradlew :framework:test --tests org.tron.core.config.ConfigurationTest./gradlew :framework:checkstyleMain./gradlew :framework:checkstyleTestFollow up
Evaluate block size, Bloom filters, shared-cache capacity, ownership, lifecycle, and observability independently with representative SR and database-specific workloads before enabling another RocksDB table profile.
Extra details
blocksizeremains configurable and observable for compatibility but is not applied to the native table factory.Closes #49
Summary by cubic
Uses RocksDB's native block-table defaults and keeps
storage.dbSettings.blocksizeonly for compatibility. Old behavior set block size, bloom filter, and cached index/filter blocks; new behavior sets no table options (defaults: 4 KB blocks, no bloom, index/filter not cached). No API, protocol, or DB-format changes.Refactors
reference.confthatblocksizeis not applied to table options.Closes tronprotocol#6939
Written for commit 14922c4. Summary will update on new commits.