Repository navigation
searcher: derive cache size from any Kubernetes quantity via shared parser - #965
Merged
marcleblanc2 merged 1 commit intoOct 19, 2026
Merged
Conversation
…arser Extract the quantity parser from sourcegraph.redis.maxmemory into sourcegraph.quantityBytes and use it for searcher.storageSize too, so Ti, Ki, fractional and suffixless values work instead of failing the render. Compute 45% the same way searcher auto-sizes (floor(bytes/1e6)*45/100) rather than treating Gi as G, and fail when the result would be 0, since an explicit 0 disables eviction. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a14718-43f2-75ab-b1b7-f2ed264868db
marcleblanc2
approved these changes
Oct 19, 2026
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.
Follow-up to #948, targeting its branch so it can be merged into the same fix. #948's allowlist (
M|Mi|G|Gi) turns1Tiand other valid PVC sizes from "silently renders0" into "helm upgraderefuses", and it can still render0for0G/1M/2M, which searcher treats as "never evict".This extracts the Kubernetes quantity parser that
sourcegraph.redis.maxmemoryalready had into a sharedsourcegraph.quantityByteshelper and uses it forsearcher.storageSize, so any quantity (1Ti,1.5G,1024Ki, suffixless bytes) works and the parser is defined once. The 45% is computed the way searcher auto-sizes (floor(bytes/1e6) * 45 / 100) instead of treatingGiasG, and the render fails when the result would be0. Behaviour change to be aware of: existingGideployments get a slightly higher value on upgrade (default26Gi:11700→12562), called out in the CHANGELOG.Test plan
helm unittest charts/sourcegraph(195 passed, incl. the unchanged Redismaxmemorysuite covering the extracted parser),helm lint,./scripts/helm-docs.shclean.searcher.storageSizemain26Gi(default)117001170012562150G067500675001Ti04947791.5G06752M/0G001Tb01Tb+autoCacheSize: true