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 historical ledger acquisition #3369

Closed
wants to merge 1 commit into from
Closed

Conversation

mtrippled
Copy link
Collaborator

  • Fix issue where historical ledgers were acquired only since the last
    online deletion interval instead of the configured value to allow deletion.

@carlhua
Copy link
Contributor

carlhua commented Apr 22, 2020

Please update the PR title with something meaningful, please. Thanks!

@mtrippled mtrippled changed the title Fix to e257a226f367b8ad5c706512d39578194c9b7dc2: Fix historical ledger acquisition Apr 22, 2020
@nbougalis
Copy link
Contributor

nbougalis commented Apr 22, 2020

Please reword this commit (either here or during a merge) thusly:

Fix historical ledger acquisition when using online deletion:

A previous commit 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.

The logic change was introduced with e257a22.

@mtrippled
Copy link
Collaborator Author

Please update the PR title with something meaningful, please. Thanks!

fixed

@mtrippled
Copy link
Collaborator Author

Please reword this commit (either here or during a merge) thusly:

Fix historical ledger acquisition when using online deletion:
A previous commit 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.
The logic change was introduced with e257a22.

fixed

@codecov-io
Copy link

Codecov Report

Merging #3369 into develop will increase coverage by 0.00%.
The diff coverage is 73.33%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3369   +/-   ##
========================================
  Coverage    70.41%   70.42%           
========================================
  Files          683      683           
  Lines        54775    54783    +8     
========================================
+ Hits         38570    38579    +9     
+ Misses       16205    16204    -1     
Impacted Files Coverage Δ
src/ripple/app/ledger/LedgerMaster.h 53.33% <ø> (ø)
src/ripple/app/misc/SHAMapStore.h 100.00% <ø> (ø)
src/ripple/app/misc/SHAMapStoreImp.h 86.84% <20.00%> (-10.22%) ⬇️
src/ripple/app/ledger/impl/LedgerMaster.cpp 42.15% <55.55%> (+0.51%) ⬆️
src/ripple/app/misc/SHAMapStoreImp.cpp 75.13% <100.00%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 020b285...0fff925. Read the comment docs.

@scottschurr
Copy link
Collaborator

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:

There are 4 circumstances that each need different ways to evaulate.

  1. no online delete
  2. online delete with advisory delete
  3. online delete without advisory delete and not currently deleting
  4. online delete without advisory delete and currently deleting

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.

@mtrippled
Copy link
Collaborator Author

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:

There are 4 circumstances that each need different ways to evaulate.

  1. no online delete
  2. online delete with advisory delete
  3. online delete without advisory delete and not currently deleting
  4. online delete without advisory delete and currently deleting

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.

nbougalis
nbougalis previously approved these changes Apr 24, 2020
Copy link
Contributor

@nbougalis nbougalis left a 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).

scottschurr
scottschurr previously approved these changes Apr 24, 2020
Copy link
Collaborator

@scottschurr scottschurr left a 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/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStore.h Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStore.h Outdated Show resolved Hide resolved
src/ripple/app/ledger/impl/LedgerMaster.cpp Show resolved Hide resolved
src/ripple/app/misc/SHAMapStore.h Outdated Show resolved Hide resolved
@@ -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
Copy link
Collaborator

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;
}
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

src/ripple/app/misc/SHAMapStoreImp.h Show resolved Hide resolved
@scottschurr
Copy link
Collaborator

@nbougalis, nice comment formatting. That does improve readability significantly. Thanks.

@mtrippled mtrippled dismissed stale reviews from scottschurr and nbougalis via 93f6198 April 28, 2020 13:47
@mtrippled
Copy link
Collaborator Author

Please reword this commit (either here or during a merge) thusly:

Fix historical ledger acquisition when using online deletion:
A previous commit 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.
The logic change was introduced with e257a22.

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.

nbougalis
nbougalis previously approved these changes Apr 28, 2020
the minimum ledger to keep available; an unseated
optional otherwise.
*/
virtual boost::optional<LedgerIndex> minimumOnline() const = 0;
Copy link
Contributor

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.

scottschurr
scottschurr previously approved these changes Apr 30, 2020
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

👍 LGTM!

@nbougalis nbougalis mentioned this pull request May 3, 2020
src/ripple/app/misc/SHAMapStoreImp.cpp Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStore.h Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStore.h Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStore.h Outdated Show resolved Hide resolved
src/ripple/app/misc/SHAMapStoreImp.cpp Show resolved Hide resolved
@mtrippled mtrippled dismissed stale reviews from scottschurr and nbougalis via c36b1ce May 13, 2020 19:01
@carlhua carlhua requested review from scottschurr and ximinez May 18, 2020 14:49
ximinez
ximinez previously approved these changes May 18, 2020
Copy link
Collaborator

@ximinez ximinez left a 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.

scottschurr
scottschurr previously approved these changes May 18, 2020
Copy link
Collaborator

@scottschurr scottschurr left a 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.

@scottschurr
Copy link
Collaborator

@mtrippled, the commit message of your most recent push looks like it got messed up. You might want to fix that.

@mtrippled mtrippled force-pushed the acquire branch 2 times, most recently from 736b88a to 5fb1b9e Compare May 19, 2020 00:50
@mtrippled
Copy link
Collaborator Author

@mtrippled, the commit message of your most recent push looks like it got messed up. You might want to fix that.

Sorry. I thought I'd make the 1st line less than 60 characters, but if it's fine as-is, I reverted it.

@scottschurr
Copy link
Collaborator

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....

@mtrippled mtrippled added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label May 19, 2020
Copy link
Collaborator

@ximinez ximinez left a 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:

  1. 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.
  2. 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.
Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants