Skip to content

Request: Support atomic writes for local storage backend #527

@mac-chaffee

Description

@mac-chaffee

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions