-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
refactor: remove dead code in cacheMergeIterator Domain() #13433
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #13433 +/- ##
==========================================
- Coverage 53.98% 53.98% -0.01%
==========================================
Files 641 641
Lines 55032 55020 -12
==========================================
- Hits 29711 29704 -7
+ Misses 22936 22934 -2
+ Partials 2385 2382 -3
|
alexanderbez
approved these changes
Oct 3, 2022
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.
Nice! nit: changelog
tac0turtle
reviewed
Oct 4, 2022
Co-authored-by: Marko <marbar3778@yahoo.com>
julienrbrt
approved these changes
Oct 4, 2022
julienrbrt
reviewed
Oct 4, 2022
julienrbrt
approved these changes
Oct 5, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
TL;DR: because the parent and the cache's domain is always the same, there's no point in doing these comparisons.
Here both parent and cache are created using the same input start and end:
cosmos-sdk/store/cachekv/store.go
Lines 179 to 196 in 252c673
The parent seems to always just take the start and end, store it in the iterator struct and then return it in its own
Domain()
:https://github.com/tendermint/tm-db/blob/b599fa5d668d5a68812ec5ebeccb9eb05235bb3a/goleveldb_iterator.go#L41-L53
https://github.com/tendermint/tm-db/blob/b599fa5d668d5a68812ec5ebeccb9eb05235bb3a/prefixdb_iterator.go#L57-L69
https://github.com/tendermint/tm-db/blob/b599fa5d668d5a68812ec5ebeccb9eb05235bb3a/rocksdb_iterator.go#L43-L55
And the cache (
cache = newMemIterator(start, end, store.sortedCache, store.deleted, ascending)
) does exactly the same (usestm-db.MemDB
):https://github.com/tendermint/tm-db/blob/b599fa5d668d5a68812ec5ebeccb9eb05235bb3a/memdb_iterator.go#L34-L43
https://github.com/tendermint/tm-db/blob/b599fa5d668d5a68812ec5ebeccb9eb05235bb3a/memdb_iterator.go#L114-L117
If I'm not missing anything we can just use the parent or cache's domain indistinctly.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change