Skip to content

FLUSHDB must fail if a data file cannot be unlinked - #20

Open
paulocsanz wants to merge 2 commits into
beyondoss:mainfrom
paulocsanz:dst/b53-flushdb-unlink
Open

FLUSHDB must fail if a data file cannot be unlinked#20
paulocsanz wants to merge 2 commits into
beyondoss:mainfrom
paulocsanz:dst/b53-flushdb-unlink

Conversation

@paulocsanz

Copy link
Copy Markdown
Contributor

ARCHITECTURE.md says flush is a destructive reset with no recovery. flush_inner cleared the in-memory index, warned on unlink errors, then open_rw without truncate and returned Ok. A leftover data-* (or the same inode if unlink of data-0 failed) resurrects the namespace on reopen.

Two commits: directory named data-999.log makes unlink fail (test expects Err + index intact), then unlink-first + fail-stop + truncate_to(0).

  • Failed flush does not drop the live index
  • New data-0 cannot inherit leftover bytes

flush_inner clears the index then warns on unlink and returns Ok.
A leftover data-* name leaves RAM empty and disk intact.
Clearing the index then warning on unlink returned Ok with disk
intact. Unlink first; on error leave the index alone. Truncate
the new data-0 so a leftover inode cannot replay.
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 this pull request may close these issues.

1 participant