fix(lapis): do not cache aggregations with many group by fields - #1850
Merged
Conversation
Aggregations that group by more than 20 columns (plain fields plus sequence-position fields) are no longer cached. The cache materializes the full result into a List to store it; for high-cardinality group-bys this can exhaust the heap (and did, causing a LAPIS outage). Such queries are now streamed straight through instead. Their cache hit rate is close to zero anyway since each filter combination is unique. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5mqrj8VN12QZfxqGNEb1d
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the stated requirement and includes appropriate unit and client-level coverage.
Pull request overview
Prevents heap exhaustion by streaming aggregations grouped by more than 20 fields instead of caching them.
Changes:
- Adds a maximum cacheable group-by field count.
- Counts metadata and sequence-position fields together.
- Tests cacheability and uncached client behavior.
File summaries
| File | Description |
|---|---|
lapis/src/main/kotlin/org/genspectrum/lapis/silo/SiloQuery.kt |
Disables caching above the threshold. |
lapis/src/test/kotlin/org/genspectrum/lapis/silo/SiloQueryTest.kt |
Tests threshold behavior. |
lapis/src/test/kotlin/org/genspectrum/lapis/silo/SiloClientTest.kt |
Verifies large aggregations bypass caching. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fengelniederhammer
approved these changes
Sep 3, 2026
fengelniederhammer
left a comment
Contributor
There was a problem hiding this comment.
Looks reasonable 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #1849
Aggregations that group by more than 20 columns (plain fields plus sequence-position fields) are no longer cached. The cache materializes the full result into a List to store it; for high-cardinality group-bys this can exhaust the heap (and did, causing a LAPIS outage). Such queries are now streamed straight through instead. Their cache hit rate is close to zero anyway since each filter combination is unique.
PR Checklist
All necessary changes are explained in thellms.txt.