Add an alternative to DeleteVersions that leaves no garbage#324
Add an alternative to DeleteVersions that leaves no garbage#324erikgrinaker merged 32 commits intocosmos:0.14.xfrom
Conversation
DeleteVersionsTo deletes all versions below the given height
|
Thanks for contributing! I see you're still making changes to this, and that there are a few linter issues. Let me know when it's ready for review! Also, maybe convert this to a draft until it's ready. |
I see linter crashing in CI / CD config, updated to 1.28 and added I finished making changes, you can proceed to check! @erikgrinaker |
|
Finished! |
|
@erikgrinaker, I added an alternative, can you check both of them? klim0v/iavl@6933e53...82251d8 |
|
I also suggest to mark the DeleteVersions method as deprecated and try to pass sorted versions from it to the DeleteVersionsInterval. |
@alexanderbez, how do you like it? |
|
I've backported a bunch of linter fixes from I'd be interested to find out exactly what this garbage you see left behind by Since |
Checks that we don't leave behind any junk in the database, as reported in #324.
|
Ok, great - did it help with the performance though? I suspect using |
Yes, it helped! Now I'm looking for an explanation of why this happened. |
|
I suppose Seek() could be slow due to the need to go through the entire tree to make sure there is no such key. |
|
Great! It may be that |
Yes, but I can't yet confirm my words with performance tests to describe this problem... |
Done ✅ |
erikgrinaker
left a comment
There was a problem hiding this comment.
Great stuff, thank you for this! Suggested a few minor nitpicks, otherwise LGTM!
|
I have added your recommendations, thanks! |
* fix: constant overflow when compiling for 32bit machines (cosmos#318) on Go 1.x(x) all constants are ints by default which causing build for 32bit machines to fail due to overflow golang/go#23086 Signed-off-by: Artur Troian <troian.ap@gmail.com> * changelog: release 0.14.2 * lint: update golangci-lint to 1.29 (cosmos#297) * ci: freeze golangci action version (cosmos#303) * github: bump golangci-lint and fix linter issues (cosmos#325) * test: check stray database entries in TestRandomOperations (cosmos#326) Checks that we don't leave behind any junk in the database, as reported in cosmos#324. * revert Protobuf methods accidentally cherry-picked in a41e36b * go.mod: bump tm-db to 0.5.2 * fix DeleteVersions stray orphans, and add DeleteVersionsRange (cosmos#324) * test: add TestRandomOperations case for DeleteVersions * test: run slow tests without race detector in CI (cosmos#338) * changelog: release 0.14.3 (cosmos#333) Co-authored-by: Artur Troian <troian@users.noreply.github.com> Co-authored-by: Erik Grinaker <erik@interchain.berlin> Co-authored-by: Marko <marbar3778@yahoo.com> Co-authored-by: Klimov Sergey <klim0v-sergey@yandex.ru>
The beginning of this issue is that the DeleteVersions method leaves behind a lot of dirty information, which leads to an increase in storage used by the storage.
I first added a method to remove versions up to a certain height, and now I have expanded it to allow removal within a given range.