Repository navigation
Pipeline cache: verify content when accepting a racing publication - #2828
andrewpozdnakov7-jpg wants to merge 3 commits into
Conversation
|
Verified
|
kotekompotek
left a comment
There was a problem hiding this comment.
Correct concurrency handling: on Windows the rename can fail only because a reader holds the published file — treating that as success iff the published bytes are identical is sound (the output is content-addressed work). Length check first, chunked compare, trailing-byte check — and unwrap_or(false) keeps genuine failures propagating. The paused-converter test exercises the real race. LGTM.
|
I resolved the conflict after #1324 landed. 2dacec0 keeps the upstream staging-write behavior and adds the byte check on rename failure. The same synthetic test on main Please preserve Git authorship if moving the comparison or test extension. If squashing it into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com |
AwsAli05
left a comment
There was a problem hiding this comment.
The first call now reports the publication mismatch. The next call can still report the wrong entry as a cache hit. I extended the Windows race fixture at 2dacec0 to call get_or_convert a second time after the error. The retry returned Ok(path) and read the original XYZ bytes for the conversion that produces ABC. The longer mismatch behaved the same way.
Can this rare path mark the mismatched entry unusable to subsequent lookups, or can the error explicitly tell the caller to invalidate it? A retry assertion would pin the expected behavior without adding any byte comparison to normal cache hits.
AI-assisted review and test using synthetic bytes.
|
Follow-up to the retry review in b80763c. The same Windows fixture on Six successful runs, all eight pipeline tests and four GPU shader-cache tests passed, plus formatting, strict pipeline Clippy, and policy. Please preserve the Git author if cherry-picking the fix or test. If folding either into another commit, please include |
|
Automated triage for the maintainers. Verdict: proposed close (was needs work). Thanks for checking the production caller and for the candid answer. As you found, the shader cache keys entries by translator source, encoding, loop limit and container bytes, and on a publication error it already returns the in-memory translation (#2055). There is no known case where two writers publish different bytes for the same key, so the byte comparison and the This will be closed in 48 hours unless you push a change (for example, with a real case where the contents differ) or a maintainer removes the label. CI: passing ( Generated by Claude Code |
|
Thanks for flagging the hot-path cost. I checked the production caller on The two reviews identify a trade-off. The failure-only comparison in If you use the comparison or the Windows fixture later, please retain the original Git author. For a combined commit, please use: Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com AI-assisted with Codex. |
…racing publication
#1324 landed as
a73d59eand covers the case where another writer publishes the correct cache entry before Windows rejects the rename. This branch keeps that behavior and checks that the existing file contains the converted bytes before accepting it.The comparison uses bounded chunks on the failure path. An unreadable entry, a different length, or different content leaves the original publishing error available to the caller. The upstream handling of staging write failures is preserved.
f3578e3: the identical entry is reused, then an existingXYZfile is incorrectly accepted for outputABC.2dacec0: the identical file is reused, and the same-length and longer mismatches return an error. The recorded file is unchanged and staging files are cleaned up.Coordination claim · Windows file sharing rules
Please retain my Git author if moving the follow-up. If you fold the comparison or test extension into another commit, please add the following trailer.
Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com
AI-assisted with Codex. Synthetic Windows file test.
Review follow-up
The same Windows fixture on
2dacec0fails because a second lookup returns the existingXYZ. Withb80763c198d6b13ca97e7aa0ee354a6721cf43b0, a separately opened cache declines both mismatches while the reader blocks replacement, then publishesABCafter the reader closes. The next lookup hitsABC; the identical-output control still hits without conversion. An empty companion marker adds a file-presence check to hits. Byte comparison is confined to failed rename attempts.Six successful runs, all eight pipeline tests and four GPU shader-cache tests passed, plus formatting, strict pipeline Clippy, and policy.