-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(db): add checkpoint v2 for db inconsistency #4614
feat(db): add checkpoint v2 for db inconsistency #4614
Conversation
3209498
to
c1edb8f
Compare
Codecov Report
@@ Coverage Diff @@
## release_v4.6.0 #4614 +/- ##
====================================================
- Coverage 54.40% 54.15% -0.26%
+ Complexity 7980 7976 -4
====================================================
Files 831 832 +1
Lines 47154 47333 +179
Branches 5106 5136 +30
====================================================
- Hits 25655 25634 -21
- Misses 19472 19661 +189
- Partials 2027 2038 +11
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
70769fa
to
2f8f8d0
Compare
@@ -55,7 +52,7 @@ protected TronDatabase(String dbName) { | |||
CommonParameter.getInstance().getStorage().getDbDirectory()).toString(); | |||
dbSource = | |||
new RocksDbDataSourceImpl(parentName, dbName, CommonParameter.getInstance() | |||
.getRocksDBCustomSettings()); | |||
.getRocksDBCustomSettings(), getDirectComparator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this?
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract method .
retreat(); | ||
checkPointV2Store.close(); | ||
logger.info("checkpoint recover success, block number{}", blockNumber); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract method .
if ("block".equals(db.getDbName())) { | ||
currentBlockNum = new BlockCapsule(v.getBytes()).getNum(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract method .
2f8f8d0
to
a010adb
Compare
if (cpList.size() < 3) { | ||
return; | ||
} | ||
for (String cp: cpList.subList(0,3)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 ---> length - 3
} else { | ||
Histogram.Timer createV2 = Metrics.histogramStartTimer( | ||
MetricKeys.Histogram.DB_FLUSH, "create2"); | ||
createCheckpointV2(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createv2
merge to create
|
||
dbs.forEach(db -> db.getHead().getRoot().merge(db.getHead())); | ||
retreat(); | ||
private void recover(TronDatabase<byte[]> tronDatabase, Map<String, Chainbase> dbMap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change dbMap to dbs
3c89a02
to
6838cd2
Compare
6838cd2
to
34764e3
Compare
What does this PR do?
Add checkpoint v2 in case of ungraceful shutdown.
Why are these changes required?
This PR has been tested by: