Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Support atomic writes for local storage backend #527

Open
mac-chaffee opened this issue Apr 14, 2022 · 1 comment
Open

Request: Support atomic writes for local storage backend #527

mac-chaffee opened this issue Apr 14, 2022 · 1 comment

Comments

@mac-chaffee
Copy link

It looks like there could be a risk of partially-written files with the local backend:

err = ioutil.WriteFile(fullpath, content, 0644)

That code appears to be writing directly to the real location of the file. So if the write is large and gets interrupted partway through (like chartmuseum is SIGKILL'd or if the file is copied/snapshotted by an external backup program), that could leave a partially-written file on disk.

Minio solves this problem by writing all files to a temporary directory, then atomically moving them into their real location after the write is fully complete: https://github.com/minio/minio/blob/d0862ddf866e6ac358155e3ca660f36610d8834e/cmd/fs-v1.go#L1105

This feature would allow users to backup their chartmuseum data the naive way (cping or taring all the files without having to stop/quiesce the application ahead of time).

Thoughts?

@cbuto
Copy link
Collaborator

cbuto commented Apr 21, 2022

thanks for reporting and fixing this @mac-chaffee! We’ll definitely want to support this, I’ll take a look at the PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants