-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
rolemembershipcache: extract cache to new package #136514
Conversation
The caching logic was getting to be quite large, and it already was nicely contained in an easy to move struct. This is a purely mechanical refactor. Release note: None
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
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.
Reviewed 8 of 8 files at r1, 11 of 11 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @fqazi and @rafiss)
pkg/sql/rolemembershipcache/cache.go
line 0 at r1 (raw file):
It seems like none of the unit tests were self-contained enough to be copied over to the new package, is that right?
These tables all have fixed IDs, so looking them up by name is not necessary. Release note: None
b659da6
to
97edf1f
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.
tftr!
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @fqazi and @spilchen)
pkg/sql/rolemembershipcache/cache.go
line at r1 (raw file):
Previously, spilchen wrote…
It seems like none of the unit tests were self-contained enough to be copied over to the new package, is that right?
that's right, and one of the benefits of this refactor is that it makes that quite clear. i didn't want to make the new tests block the improvement to organizing the code.
though one related test is in pkg/sql/cacheutil
. we started to make a general purpose package for caches that work like this one, but unfortunately haven't updated them all to use that package. each cache has subtle differences in implementation that makes the consolidation a bit tricky to get right.
cockroach/pkg/sql/cacheutil/cache_test.go
Line 21 in 9f61a38
func TestCache(t *testing.T) { |
The caching logic was getting to be quite large, and it already was
nicely contained in an easy to move struct.
This is a purely mechanical refactor.
sql, sessioninit: lookup tables by ID, not name
These tables all have fixed IDs, so looking them up by name is not
necessary.
Epic: None
Release note: None