-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Off-chain] feat: in-memory query cache(s) #994
base: main
Are you sure you want to change the base?
Conversation
(cherry picked from commit 7d48aef23354497be55958ad2f484e1734550249)
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.
@bryanchriswhite I did a superficial review but did not dive into the validation of the business logic line-by-line.
Is there any section where you'd want another pair of 👀 ?
Co-authored-by: Daniel Olshansky <olshansky.daniel@gmail.com>
4ac0eef
to
011d2d7
Compare
011d2d7
to
d5ce62f
Compare
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.
Love the iteration. Thanks @bryanchriswhite!
Left a few new comments, a few replies to older threads, but it should be g2g after the next round 🙌
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.
Great caching design.
Left some comments but did not tend to pkg/client/query/cache/memory_test.go
yet. Which I'll do right after this one.
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.
Left few comments but it feels like the current implementation is calling for having an interface and implementation for each type of cache (historical, non-historical).
It will remove a lot of conditional branching and runtime errors.
Co-authored-by: red-0ne <red-0ne@users.noreply.github.com>
Co-authored-by: red-0ne <red-0ne@users.noreply.github.com>
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.
This shape is easier to read and reason about 👍
I left some comments but should be trivial to address.
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.
Just realized I never published my review from yesterday :(
pkg/client/query/cache/config.go
Outdated
historical bool | ||
// maxVersionAge is the max difference between the latest known version and | ||
// any other version, below which value versions are retained, and above which | ||
// value versions are pruned. |
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.
Are they pruned or just not considered cache hits? #PUC
If they're evicted, please make that explicit.
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.
All of the above ("pruned" == "evicted" == "deleted"). As it states, they ARE pruned. The word "evict" has only been used so far in a slightly different context, related to the MaxKeys
config field.
Do you have a specific suggestion on how to improve clarity here?
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.
// value versions are pruned. | |
// value versions are pruned (i.e. evicted). |
Co-authored-by: red-0ne <red-0ne@users.noreply.github.com> Co-authored-by: Daniel Olshansky <olshansky.daniel@gmail.com>
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.
@bryanchriswhite I did a "show changes since your last review" and it seems like all the files have changed?
Either way, lmk when this is ready for a re-review.
Summary
Adds the
QueryCache[T any]
andHistoricalQueryCache[T any]
interfaces,InMemoryCache[T any]
implementation, configurations, and options functions.Issue
Type of change
Select one or more from the following:
consensus-breaking
label if so. See [Infra] Automatically add theconsensus-breaking
label #791 for detailsTesting
make docusaurus_start
; only needed if you make doc changesmake go_develop_and_test
make test_e2e
devnet-test-e2e
label to the PR.Sanity Checklist