Skip to content

fix: improve restore consistency and add fsck command#53

Closed
KGFCH2 wants to merge 1 commit into
Rakshat28:mainfrom
KGFCH2:feature/restore-consistency-fsck
Closed

fix: improve restore consistency and add fsck command#53
KGFCH2 wants to merge 1 commit into
Rakshat28:mainfrom
KGFCH2:feature/restore-consistency-fsck

Conversation

@KGFCH2

@KGFCH2 KGFCH2 commented May 11, 2026

Copy link
Copy Markdown
Contributor

@Rakshat28
Addresses #44.

Summary

This PR introduces major reliability and recovery improvements to bdstorage by hardening the restoration pipeline and adding a new integrity auditing command for long-term vault maintenance.

Key Changes

Atomic Restore Workflow

  • Refactored the restoration pipeline to prioritize consistency and crash safety over batch performance.
  • Database updates are now committed immediately after each successful file restoration and atomic rename operation.
  • Ensures that unexpected interruptions (such as SIGKILL, crashes, or power loss) only impact the file currently being processed rather than corrupting the broader restore state.

fsck Subcommand

  • Added a new fsck command for performing a full "ground-truth" audit of the vault.
  • The command:
    • Walks the filesystem directly
    • Verifies hard links and stored metadata
    • Reconciles inconsistencies with the redb state
    • Cleans up leaked vault entries
    • Repairs incorrect reference counts caused by interrupted operations or prior failures

State API Extensions

  • Added list_all_files to the internal state management layer.
  • Enables efficient full-database traversal and integrity validation workflows required by fsck.

Result

These changes significantly improve the resilience of bdstorage against crashes and interrupted operations while providing users with a dedicated toolset for maintaining long-term vault integrity and deduplication correctness.

@Rakshat28 Rakshat28 closed this May 16, 2026
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.

2 participants