feat(db): remove function for periodic backup of the RocksDB database#74
feat(db): remove function for periodic backup of the RocksDB database#74
Conversation
📝 WalkthroughWalkthroughThe pull request removes the complete database backup feature from the codebase, including configuration classes, Spring AOP aspects, backup utilities, related test classes, and test configuration files. All backup-related constants and field dependencies are also eliminated. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
framework/src/test/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImplTest.java (1)
126-140:⚠️ Potential issue | 🟡 MinorRemove
backupAndDeletetest and its corresponding dead code methods.The
backup()anddeleteDbBakPath()methods have no production callers—they are invoked only by this test. Since the PR removes the database backup feature, these low-level RocksDB APIs appear to be dead code. Remove the test and consider removing the unused methods fromRocksDbDataSourceImplas well.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@framework/src/test/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImplTest.java` around lines 126 - 140, Delete the JUnit test method backupAndDelete in RocksDbDataSourceImplTest and remove the corresponding unused production methods backup(...) and deleteDbBakPath(...) from the RocksDbDataSourceImpl class (and any trivial helpers that only support them); ensure you also remove any imports or test utilities used solely by that test and run tests to confirm no other callers reference backup(...) or deleteDbBakPath(...).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@framework/src/test/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImplTest.java`:
- Around line 126-140: Delete the JUnit test method backupAndDelete in
RocksDbDataSourceImplTest and remove the corresponding unused production methods
backup(...) and deleteDbBakPath(...) from the RocksDbDataSourceImpl class (and
any trivial helpers that only support them); ensure you also remove any imports
or test utilities used solely by that test and run tests to confirm no other
callers reference backup(...) or deleteDbBakPath(...).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6c667cd3-3c5e-41cb-9a1d-45e49ddc5bfa
📒 Files selected for processing (13)
common/src/main/java/org/tron/common/config/DbBackupConfig.javacommon/src/main/java/org/tron/common/parameter/CommonParameter.javaframework/src/main/java/org/tron/core/config/DefaultConfig.javaframework/src/main/java/org/tron/core/config/args/Args.javaframework/src/main/java/org/tron/core/config/args/ConfigKey.javaframework/src/main/java/org/tron/core/db/backup/BackupDbUtil.javaframework/src/main/java/org/tron/core/db/backup/BackupRocksDBAspect.javaframework/src/main/java/org/tron/core/db/backup/NeedBeanCondition.javaframework/src/test/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImplTest.javaframework/src/test/java/org/tron/core/db/backup/BackupDbUtilTest.javaframework/src/test/java/org/tron/program/SupplementTest.javaframework/src/test/resources/config-test-dbbackup.confplugins/src/test/java/org/tron/plugins/DbLiteTest.java
💤 Files with no reviewable changes (12)
- plugins/src/test/java/org/tron/plugins/DbLiteTest.java
- common/src/main/java/org/tron/common/parameter/CommonParameter.java
- framework/src/test/java/org/tron/program/SupplementTest.java
- framework/src/main/java/org/tron/core/db/backup/NeedBeanCondition.java
- framework/src/main/java/org/tron/core/config/args/Args.java
- framework/src/test/resources/config-test-dbbackup.conf
- framework/src/main/java/org/tron/core/config/DefaultConfig.java
- framework/src/main/java/org/tron/core/db/backup/BackupRocksDBAspect.java
- framework/src/test/java/org/tron/core/db/backup/BackupDbUtilTest.java
- framework/src/main/java/org/tron/core/config/args/ConfigKey.java
- common/src/main/java/org/tron/common/config/DbBackupConfig.java
- framework/src/main/java/org/tron/core/db/backup/BackupDbUtil.java
What does this PR do?
Removes the periodic database backup feature (
storage.backup) entirely. This includes the backup configuration class, the AspectJ aspect that interceptedpushBlockto trigger copies, the backup utility, and all associated test fixtures and config files.Closes tronprotocol#6595.
Why are these changes required?
The
storage.backupfeature was designed to guard against data corruption from disk failures or abrupt process termination (e.g.kill -9). It has since become more harmful than helpful:kill -9does not corrupt RocksDB, which was the primary motivation for the feature.node.backup(UDP keep-alive failover). If one node becomes unavailable, traffic can be switched to the standby without any file-copy disruption.Changes:
DbBackupConfig,BackupDbUtil,BackupRocksDBAspect,NeedBeanCondition(common/framework).CommonParameter.dbBackupConfigfield andArgs.initRocksDbBackupProperty()initialiser.ConfigKey.STORAGE_BACKUP_*constants and the conditionalbackupRocksDBAspectSpring bean fromDefaultConfig.BackupDbUtilTestandconfig-test-dbbackup.conf; updatedRocksDbDataSourceImplTestandSupplementTestto useTEST_CONF.storage.backupblock is no longer read and has no effect. Nodes carrying this section in their config file can leave it in place without error, but it will be silently ignored.Backward Compatibility: Not compatible with v4.8.1 or older.
This PR has been tested by:
Follow up
Operators who currently rely on
storage.backupshould migrate to thenode.backupprimary–backup failover configuration.Extra details
N/A