Skip to content

Conversation

@lesnik2u
Copy link

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

@lesnik2u lesnik2u changed the title [WIP] CNDB-15360 Chunk Cache inspection [WIP] CNDB-15360 Chunk Cache inspection POC Nov 24, 2025
@github-actions
Copy link

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@lesnik2u lesnik2u marked this pull request as ready for review November 26, 2025 11:42
Copy link

@eolivelli eolivelli left a 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about ChunkCacheEntryMetadata ?

@lesnik2u lesnik2u force-pushed the CNDB-15360-ChunkCache branch from 1fa7663 to 1c9a057 Compare November 28, 2025 13:05
@sonarqubecloud
Copy link

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-2140 rejected by Butler


3 regressions found
See build details here


Found 3 new test failures

Test Explanation Runs Upstream
o.a.c.index.sai.cql.VectorCompaction100dTest.testOneToManyCompaction[eb true] NEW 🔴 0 / 19
o.a.c.index.sai.cql.VectorSiftSmallTest.testCompaction[db false] REGRESSION 🔴 0 / 19
o.a.c.sensors.SensorsIndexWriteTest.BeforeFirstTest NEW 🔴 1 / 19

No known test failures found


// File id management
private final ConcurrentHashMap<File, Long> fileIdMap = new ConcurrentHashMap<>();
private final ConcurrentHashMap<Long, File> idToFileMap = new ConcurrentHashMap<>();

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants