-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Pruning Refactor #6475
Pruning Refactor #6475
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6475 +/- ##
==========================================
+ Coverage 55.60% 56.31% +0.71%
==========================================
Files 457 470 +13
Lines 27440 28178 +738
==========================================
+ Hits 15257 15869 +612
- Misses 11083 11187 +104
- Partials 1100 1122 +22 |
In the current design, no, as it's meant to be dead-simple using an ephemeral map. If
Can you elaborate? Do you mean retroactively calling that method on start and remove anything we missed since (re)start? |
I'll leave that for the SDK team to judge, but as a user I might be surprised if it's not pruning what it's supposed to.
If the pruning simply scans available versions and deletes those that match the pruning predicate then it will always remove the stuff that it's supposed to - after a pruning run the entire database is consistent with the current pruning settings. Of course, it needs to be careful so that it doesn't accidentally remove everything if the previous and current settings do not have any overlap at all - I guess |
That makes sense @erikgrinaker, although, for the concern you've laid out, I would be wary of retroactively applying a new pruning strategy to all previous heights. In addition, it could have very costly IO.
True, but we can clearly document this. To keep the mental model simple, I would have heights pruned based on the strategy used at the time of the height being committed. In order to do this, we could persist the heights to prune during What do you think about this approach? I would either consider this or leave as-is and document this corner-case. |
That makes sense, your call as to whether they should be persisted or not. |
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, a few nits and doc comments
@AdityaSripal @erikgrinaker I've updated the PR a bit to now flush The overhead in storing |
Nice one @alexanderbez As to backporring. The proper semantic versioning thing would be to release 0.38 + iavl fixes as 0.39, which is an easy code upgrade from 0.38. And then stargate "the release formerly known as 0.39" could be 0.40 |
Afaik, there are only testnets on 0.38 and no one has brought it to production |
Based on users of latests TM KMS alpha, we have Band, Kava, Commercio and Desmos as mainnets using 0.38. |
At Unification (FUND), we have also deployed v0.38 on our MainNet |
Mhhh, in that case you may as well wait for the full 0.39. I was under this impression 0.38.5 would just have these fixes and that's it. If we're going to cut 0.39 off of master after this PR, I believe we may as well wait then and not even bother backporting. |
Given that most of protobuf conversion is on master, I think the 0.38 networks will want a backport. |
Huh? There are tons of open issues and PRs for 0.39 milestone: https://github.com/cosmos/cosmos-sdk/issues?q=is%3Aopen+is%3Aissue+milestone%3Av0.39 And if "IBC 1.0" is supposed to be part of that, even more issues: https://github.com/cosmos/cosmos-sdk/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22v1.0+LTS%22 I think there is no sense in cutting a release off master until all that is stabilized. Best to have a stable point to upgrade to. |
This is a good point, then any 0.38.5 / Launchpad release should be easy to upgrade to from exisiting 0.38.x networks. Ideally they just restart with a new binary. If it is trickier, then we should test that and provide a path forward (via the upgrade module?) but ideally avoid any changes that break state on disk |
Right, I agree. Hence, I'm confused by your original statement:
EDIT: Nvm, I understand what you mean. This is an option, one I'm not going to make the call on. I would love for others to weigh in here. Ideally, we just accept 0.38.5 with some client API breaking changes (very minor) or we cut 0.39 and have to rework our milestones and projects :-/ |
Fair enough. I have no strong opinion against 0.38.5, just pointing out what the "proper way" to handle this is. Everyone is looking forward to 0.39 so a renumbering would also be confusing |
Totally understandable. Your suggestion is certainly the "correct" approach. |
Description
In order to re-introduce the old pruning behavior while also attempting to address concerns around pruning, the following changes are made. Note, that this process fundamentally requires a few client-facing API breaking changes. In order to backport this to the 0.38 line, we must be OK with this (@zmanian @jackzampolin).
Client Changes:
"syncable"
to"default"
-- the former doesn't make any sensekeep-recent
andkeep-every
optionsinterval
option to allow operators to decide when the pruning actually happensProtocol changes
iavl/store.go
Commit
, we commit stores as we typically do. However, we bubble up the existing pruning check and execution fromiavl/store.go
to here.interval
usingMutableTree#DeleteVersions
. This should yield at least a moderate performance gain especially with some changes @erikgrinaker will be making to orphans.Example:
With
keepRecent=100;keepEvery=50;interval=10
and at current height is500
, we'd have the following heights on disk: 400-500, 350, 300, 250, 200, 150, 100, 50. When the next height, 501, comes, we know we need to prune this, but we don't do it yet. We keep this decision in memory. We do this up to 510 and then finally delete 501-510 all at once. This repeats for 511-520 and so on.DeleteVersions
and the removal of the pruning behavior introduced in IAVL 0.13./cc @ethanfrey @erikgrinaker
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorer