Skip to content
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

fix(db/trans-cache):avoid dumping a wrong cached data #5491

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ private boolean handleException(Throwable e) {
private void dump() {
if (!isValid.get()) {
logger.info("bloomFilters is not valid.");
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may cause the dump() to have a probability of being skipped.

What about waiting for the isValid to be true for a certain time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very friendly, potentially a long time, like node just starting up as before, cost 15+ s.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I see, isValid is used for sync dump() with flush(), isAlive is used for recovery().

isValid changes from false to true may not take a long time, just waiting for 1 or 2 seconds is enough?

Copy link
Contributor Author

@halibobo1205 halibobo1205 Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's really no need to think about flush() for kill -15, flush() will always take precedence in here https://github.com/tronprotocol/java-tron/blob/release_v4.7.3/framework/src/main/java/org/tron/common/application/ApplicationImpl.java#L73

}
FileUtil.createDirIfNotExists(this.cacheDir.toString());
logger.info("dump bloomFilters start.");
Expand Down