Repository navigation
fix(flytestdlib): stop serving stale cache after a large overwrite - #8239
Merged
pingsutw merged 1 commit intoOct 26, 2026
Merged
Conversation
WriteRaw stores the new bytes, but when they exceed the freecache entry cap, Set fails and the previous value stays cached, so later reads in the same process return the old bytes. Datacatalog hits this when an overwrite-cache run replaces a small output with a large one. Drop the key when Set fails so the next read goes to the store. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8239 +/- ##
==========================================
+ Coverage 56.56% 57.34% +0.78%
==========================================
Files 772 931 +159
Lines 52305 58338 +6033
==========================================
+ Hits 29587 33455 +3868
- Misses 19961 21832 +1871
- Partials 2757 3051 +294
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pingsutw
approved these changes
Oct 26, 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.
Tracking issue
Related to #8130
Why are the changes needed?
Overwriting cached outputs can leave datacatalog serving the old ones. When an overwrite-cache run replaces a task's cached outputs with larger ones, datacatalog writes the new data to the same location, but its in-memory storage cache keeps the old copy. Every later cache hit in that process returns the old outputs until the entry is evicted or the process restarts.
The in-memory cache only accepts entries up to 1/1024 of its configured size, about 10 KB with datacatalog's sample config. A bigger write lands in the store, the cache rejects it, and the storage layer treats the rejection as harmless, so the previous entry is never removed.
What changes were proposed in this pull request?
When the cache rejects new bytes, the storage layer now drops the cached entry for that path, so the next read goes to the store. Writes that fit still replace the entry as before. Other datacatalog replicas keep their own caches, so this fixes reads in the process that did the write.
How was this patch tested?
Added a unit test that overwrites a cached value with one too big for the cache.
Testing Done
I built datacatalog from master (2682923) and from this branch, ran each with the sample config's cache (max_size_mbs: 10), local file storage and an empty Postgres 14 database, and drove it over gRPC. The script follows the cache client: create and tag the artifact, read it by tag, overwrite it with UpdateArtifact, then read it again.
Reproducer source: cache-e2e.sh
Reproducer source: datacatalog.yaml
./datacatalog --config datacatalog.yaml migrate run ./datacatalog --config datacatalog.yaml serve & bash cache-e2e.shOn master, the cache keeps returning the 100-character output after the overwrite, while the stored file holds the new one:
On this branch, the read after the overwrite returns the new output:
Labels
Setup process
Screenshots
Check all the applicable boxes
Related PRs
#8130
Stack
No git town stack.
Docs link