Skip to content

Make KVTree file writes failure resistant #40

@tonyhutter

Description

@tonyhutter

If there's a crash during kvtree_file_write(), it could result in a corrupted kvtree file (ECP-VeloC/AXL#83). @adammoody suggested that each kvtree_file_write() create a new file that gets rename()'d to the final filename. A rename() is atomic on Linux. This means that if there's a failure during the write, then kvtree_read_file() is going to return the kvtree state before the failed write rather than an error. We also may want to consider writing to the new kvtree file with O_DIRECT or O_ATOMIC for even more protection.

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