You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
apko: make apk cache safer for multi-writers (#1564)
Currently the cached files are `mv` to the final destination. While this
works for a single process of `apko`, if there are multiple `apko`
processes running, an existing file read can be invalidated if the file
is later replaced (with another file with the same content).
This PR changes to leverage symlink instead. Since file reads in Go by
default will follow symlink at file open time, overwriting the symlink
won't invalidate existing reads.
We also check for the existence of the destination file before
attempting to advertise the cached file, and we clean up the cached file
if we didn't create a symlink at all. This is safe because there should
be no way anyone else could read our version of the cache file.
I've tested with both NFS and gcs-fuse FS.
---------
Signed-off-by: Nghia Tran <[email protected]>
0 commit comments