-
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: make cachekv store thread-safe again #14378
Conversation
Closes: cosmos#14376 Solution: - copy isolated sortedCache when starting iterating - cleanup deletion logic
store/cachekv/internal/btree.go
Outdated
if (start != nil && len(start) == 0) || (end != nil && len(end) == 0) { | ||
return nil, errKeyEmpty | ||
panic(errKeyEmpty) |
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.
Why are we panic over error? Ideally, the caller can handle the error.
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.
I'm just trying to make it similar to KVStore
interface, it's usage in the store is side with the parent store, so i try to make the interface similar to the parent store.
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.
Yes, but I'd argue those interfaces are bad.
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.
agree, fixed.
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
@Mergifyio backport release/v0.47.x |
backporting as per #14798 (comment) |
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit f1ee974) # Conflicts: # CHANGELOG.md # store/cachekv/internal/btree.go # store/cachekv/internal/memiterator.go
✅ Backports have been created
|
Description
Closes: #14376
Solution:
go test -run=^$ -bench=. -benchmem ./store/cachekv/... -count=10
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