feat(log): optimize open db log#5385
Conversation
chainbase/src/main/java/org/tron/common/storage/leveldb/LevelDbDataSourceImpl.java
Outdated
Show resolved
Hide resolved
chainbase/src/main/java/org/tron/common/storage/leveldb/LevelDbDataSourceImpl.java
Show resolved
Hide resolved
6c43e7f to
66cba65
Compare
| } | ||
| } catch (IOException e) { | ||
| if (e.getMessage().contains("Corruption:")) { | ||
| throw new RuntimeException(String.format("Can't initialize database: %s, please delete " + |
There was a problem hiding this comment.
Please do not throw an exception here. If you do not know what to do, please refer https://github.com/tronprotocol/java-tron/blob/develop/framework/src/main/java/org/tron/core/db/Manager.java#L572. And, please keep the changes to the RocksDB.
There was a problem hiding this comment.
Please do not throw an exception here. If you do not know what to do, please refer https://github.com/tronprotocol/java-tron/blob/develop/framework/src/main/java/org/tron/core/db/Manager.java#L572. And, please keep the changes to the RocksDB.
Just exit when open db fail is ok.@halibobo1205
865ea1b to
41536aa
Compare
chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImpl.java
Show resolved
Hide resolved
| } | ||
| } catch (IOException e) { | ||
| if (e.getMessage().contains("Corruption:")) { | ||
| logger.error("Database {} corrupted, please delete database directory({}) " + |
There was a problem hiding this comment.
There was a problem hiding this comment.
please refer https://github.com/tronprotocol/java-tron/blob/develop/framework/src/main/java/org/tron/core/db/Manager.java#L572
@halibobo1205 Just print the same message as L572? Or just exit when any exception is caught?
There was a problem hiding this comment.
- Exit when any db exception is caught
- Give a tip just like L572 when db is corrupted.
There was a problem hiding this comment.
- Exit when any db exception is caught
- Give a tip just like L572 when db is corrupted.
@halibobo1205 done.
Add suggestion when open db fail.
41536aa to
3dacceb
Compare
tomatoishealthy
left a comment
There was a problem hiding this comment.
LGTM, fix the CI check
| Args.getInstance().getOutputDirectory(), "test_reset"); | ||
| dataSource.resetDb(); | ||
| assertEquals(0, dataSource.allKeys().size()); | ||
| assertEquals("LEVELDB", dataSource.getEngine()); |
There was a problem hiding this comment.
Please add a test to cover this PR, do not add tests that is not relevant in this PR
There was a problem hiding this comment.
Please add a test to cover this PR, do not add tests that is not relevant in this PR
done. @halibobo1205
| Args.getInstance().getOutputDirectory(), "test_reset"); | ||
| dataSource.resetDb(); | ||
| assertEquals(0, dataSource.allKeys().size()); | ||
| assertEquals("ROCKSDB", dataSource.getEngine()); |
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## develop #5385 +/- ##
==========================================
Coverage 60.92% 60.92%
- Complexity 9231 9238 +7
==========================================
Files 839 839
Lines 50029 50038 +9
Branches 5574 5576 +2
==========================================
+ Hits 30479 30487 +8
- Misses 17165 17169 +4
+ Partials 2385 2382 -3
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
e968b90 to
d860a4e
Compare
d860a4e to
6f082a8
Compare
What does this PR do?
Add suggestion when open db fail.
Why are these changes required?
To improve user-friendliness.