Backup and Restore
Backups for HestiaStore are filesystem-level backups of the index directory plus the operational procedure around them. This page describes practical strategies that are easy to reason about.
What must be backed up
Back up the whole index directory, including:
- segment data files
- index metadata
- lock-free closed-state contents
- the
wal/directory when WAL is enabled
Do not back up only selected files from an active index and assume the result is recoverable.
Recommended backup strategies
Best: cold backup
- Stop writes.
- Close the index cleanly.
- Copy or snapshot the directory.
- Reopen the index.
This is the simplest and lowest-risk procedure.
Acceptable: coordinated snapshot
If you cannot fully stop the host process:
- Quiesce application writes to the target index.
- Call
flush(). - Take a filesystem snapshot or directory copy.
- Resume writes.
Use this only when the surrounding application can reliably coordinate the pause window.
After an unclean shutdown
Do not treat the first recovered post-crash state as your new clean backup without validation.
- Reopen the index.
- Run
checkAndRepairConsistency(). - If WAL is enabled, inspect the WAL directory with
wal_verify. - Optionally run
compact()if you want a cleaner on-disk layout. - Take a fresh backup only after the index is healthy again.
Restore procedure
- Restore the full directory to the target host or path.
- Ensure no stale process is holding the
.lockfile. - Open the index with the expected configuration.
- Run
checkAndRepairConsistency(). - Perform spot-check reads on known keys.
- Resume application traffic only after the checks pass.
WAL-specific notes
- If WAL is enabled, restore the
wal/directory together with the index data. - Use
wal_verifybefore reopening when the backup source or transport might have corrupted files. - Prefer the WAL Canary Runbook before turning WAL on for critical indexes.
Validation checklist
- The restored index opens successfully.
checkAndRepairConsistency()completes without unrecoverable errors.- Expected keys can be read.
- Monitoring shows healthy state after restore.
- A new backup window is scheduled after major repair or compaction work.