-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 historical ledger acquisition #3369
Conversation
Please update the PR title with something meaningful, please. Thanks! |
Please reword this commit (either here or during a merge) thusly:
|
fixed |
fixed |
Codecov Report
@@ Coverage Diff @@
## develop #3369 +/- ##
========================================
Coverage 70.41% 70.42%
========================================
Files 683 683
Lines 54775 54783 +8
========================================
+ Hits 38570 38579 +9
+ Misses 16205 16204 -1
Continue to review full report at Codecov.
|
I have the advantage of having visibility of some offline discussions regarding this pull request. One of the points brought up in those discussions was:
I would like this pull request to incorporate that comment (or something like it) into the code base. And, furthermore, I'd like to see a paragraph for each of those circumstances describing the expected behavior. Then a second paragraph for each circumstance summarizing how the code accomplishes that behavior. |
I cleaned up the conditions for acquiring ledgers, and made a clear comment in the function that determines the minimum ledger to keep. |
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.
Looks good. Consider cherry-picking dc7a01b (but double-check if the comment remains accurate).
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.
👍 It looks good to me modulo a few nits. But I didn't see anything I'd hold up the pull request for.
src/ripple/app/misc/SHAMapStore.h
Outdated
@@ -66,6 +68,40 @@ class SHAMapStore | |||
|
|||
/** Returns the number of file descriptors that are needed. */ | |||
virtual int fdRequired() const = 0; | |||
|
|||
/** If online deletion is enabled, return the minimum ledger |
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.
Thanks for the comment. It helps.
auto const minSql = app_.getLedgerMaster().minSqlSeq(); | ||
if (minSql.has_value()) | ||
minimumOnline_ = *minSql; | ||
} |
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.
Just as a sanity check, if advisorDelete_
is false
and there are no local persisted ledgers then minimumOnline_
will be zero. I'm assuming that's the desired behavior?
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.
Good catch--actually, in that case, the desired behavior is to not try to acquire ledgers from the network based on this value. I fixed this in the minimumOnline() function. It would be nice to have a std::atomic<boost::optional> but oh well.
Basically, if we don't know the specific lower bound of things to keep online, don't try to acquire historical ledgers based on this unknown.
@nbougalis, nice comment formatting. That does improve readability significantly. Thanks. |
I used your commit message (with a slight edit). But I prefer explicitly evaluating has_value() rather than setting the equivalent underlying value because it makes clear that only a known value should trigger an action. The point of optional is to make clear the intentions in that case, and not to rely upon setting and interpreting values for special cases. |
src/ripple/app/misc/SHAMapStore.h
Outdated
the minimum ledger to keep available; an unseated | ||
optional otherwise. | ||
*/ | ||
virtual boost::optional<LedgerIndex> minimumOnline() const = 0; |
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.
Extra spaces here. This can be probably resolved with clang-format
better than you manually editing the file. We can do this during merge.
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.
👍 LGTM!
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.
Looks good with the simplifications. I'm still not entirely sold on changing the behavior change with can_delete
, but it does work as designed.
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.
Looks good as far as I can see.
@mtrippled, the commit message of your most recent push looks like it got messed up. You might want to fix that. |
736b88a
to
5fb1b9e
Compare
Sorry. I thought I'd make the 1st line less than 60 characters, but if it's fine as-is, I reverted it. |
Thanks. Personally, I think a fairly complete sentence for the first line is more important than the 60 character limit. It's all about trade offs.... |
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.
Looks good with the rebase.
Two things of note:
- Travis CI failed in the Mac / xcode build. This is an unrelated issue addressed elsewhere, but we should be careful to confirm that the next beta build succeeds.
- The formatting of SuiteJournal.h was changed, presumably by the updated version of
clang-format
that some of us are discussing offline. I don't think any change needs to be made, but we may need to watch out for conflicts later if a bunch of other PRs make the same change.
Commit e257a22 introduced changes in the logic used to acquire historical ledgers. The logic could cause historical ledgers to be acquired only since the last online deletion interval instead of the configured value to allow deletion.
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.
👍
online deletion interval instead of the configured value to allow deletion.