Evict remote objects from every cache layer #128
Reference in New Issue
Block a user
Delete Branch "benvin/fix-epel-eviction"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Evicting a remote object only deleted its Postgres row. The S3 index and the Redis TTL/ETag keys survived, so stale mirror metadata such as EPEL repodata kept being served.
Engine.Evict<dir>/*; other wildcards return 400, unknown remotes 404DeletePrefixinstead of deleting nothing*gives an empty prefix and wipes every artifact row, index object and TTL/ETag key for the remote, with no guard and no test (previously a no-op) → decide explicitly: reject an empty prefix, or keep it and add a test that pins it.changingUpstreamignores If-None-Match and always returns 200, so a survivingetag:key would not fail either test → make the upstream honour If-None-Match (304 when it matches) so the stale-ETag path is caught, or assert directly thatForgetPath/ForgetPrefixremoveetag:keys.ForgetPath/ForgetPrefixand theglobEscaperhave no direct test (a remote or path containing*,?,[) → add a small Redis-backed test./locals/.../objectsis now givens.enginealthoughevictLocalnever uses it, andNewObjectsHandler(db, nil)panics on a remote DELETE → nit: take the evictor only whereevictis routed, or nil-guard.ObjectInfo.Err, so a failed listing yields zero deletes and returns nil → 204 with stale index objects left. Range the list channel yourself, return onobj.Err, and feed keys to RemoveObjects.return res.Errabandons the RemoveObjects result channel, leaking its goroutine → keep draining (record first error, return after the loop).8*,e*ora*deletes every artifact row, index object and Redis key of that remote beginning with that char (rows for immutable RPMs force a full re-download) → require the prefix to end in/(or a minimum depth) and return 400 otherwise.defer ReleaseLock(ctx, ...)uses the request ctx, so a cancelled request leaves the lock held until TTL → release withcontext.WithoutCancel(ctx); return 409/503 rather than proceeding unlocked on timeout.TestEvictMutableIndexRefetchesand the wildcard test still pass if Evict only clears the Redis keys: with the TTL gone, Fetch re-fetches upstream and overwrites the index/artifact row anyway. Nothing fails ifDeleteArtifact,store.Delete,DeleteArtifactsByPrefixorDeletePrefixare removed → assert directly that theartifactsrow andIndexKeyobject are absent after Evict (andDeletePrefixspares sibling-prefix and other-remote keys).TestEvictWaitsForFetchLocknever checks the lock is released after Evict (dropping thedefer ReleaseLockpasses) and never covers ctx cancellation or the 30s give-up → assertAcquireLocksucceeds after Evict returns; add a cancelled-ctx case.No findings.