-
Notifications
You must be signed in to change notification settings - Fork 21
[WIP] CNDB-15360 Chunk Cache inspection POC #2140
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
base: main
Are you sure you want to change the base?
Conversation
Checklist before you submit for review
|
eolivelli
left a comment
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 have left a couple of suggestions, you are on your way.
Let's add unit tests, there are some tests about ChunkCache, you can add them there.
We don't really care about the implementation of Caffeine, you will hardly have a deterministic behavior for ordering, for the unit tests it is just enough to ensure that if there is something that it is returned correctly, in any order
| return (int) cacheAsMap.keySet().stream().filter(x -> (x.readerId & mask) == fileId).count(); | ||
| } | ||
|
|
||
| public static class ChunkCacheInspectionEntry |
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.
what about ChunkCacheEntryMetadata ?
1fa7663 to
1c9a057
Compare
|
❌ Build ds-cassandra-pr-gate/PR-2140 rejected by Butler3 regressions found Found 3 new test failures
No known test failures found |
|
|
||
| // File id management | ||
| private final ConcurrentHashMap<File, Long> fileIdMap = new ConcurrentHashMap<>(); | ||
| private final ConcurrentHashMap<Long, File> idToFileMap = new ConcurrentHashMap<>(); |
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 is going to use lot of memory (and use CPU on hot paths) for a feature that will be used only in DEV/TEST to investigate the behavior of the ChunkCache, it is not really worth to take this way.
| } | ||
|
|
||
| @Test | ||
| public void testInspectHotEntries() throws IOException |
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.
it is not possible to ensure that an entry is seen as "hot" or "cold" by caffeine, this is going to be a flaky test, it's not a simple LRU cache
I suggest to make this simpler: load some data, get the hottest and the coldest and check that the values on the results have some sense: file name is real filename that was put in to the cache



What is the issue
https://github.com/riptano/cndb/issues/15360
What does this PR fix and why was it fixed
Add ability to inspect hot and cold entries inside of caffeine chunkCache