Add hot backup and restore support#5514
Open
kdletters wants to merge 9 commits into
Open
Conversation
Move backup orchestration out of the engine deep core. Harden snapshot durability, cancellation, and output path claims. Validate restore metadata and aggregate rollback failures. Scope scheduled retention by database and preserve ownership markers. Keep control-db storage compatibility and invalidate snapshots without durable history. Update Windows atomic replacement and operator documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Adds durable hot backup creation for running, disk-backed databases and offline restore support.
spacetime backup createandspacetime backup restore, plus a server endpoint confined to a configured hot-backup root.manifest.jsonlast.No related public ticket or PRD was identified.
AI Assistance
This change was developed with assistance from OpenAI Codex and GPT-5.5.
API and ABI breaking changes
This expands public Rust API surface with hot-backup manifest/in-progress types, default
NodeDelegatemethods, a providedSnapshotRepoinvalidation helper, andAction::CreateHotBackup.Existing trait implementations remain compatible because the new trait methods have defaults. Exhaustive downstream matches on
Actionmay require an update for the new variant. No wire-format or binary ABI break is intended.Expected complexity level and risk
5 / 5.
The change crosses snapshot creation, durability tracking, commitlog copying, control-db export, program storage, HTTP authorization, standalone lifecycle operations, filesystem crash consistency, restore rollback, scheduled retention, and Windows replacement semantics. The highest-risk boundaries are ensuring the snapshot never outruns durable history, keeping exported server metadata consistent with the replica, preserving the original target on failed restore, and preventing concurrent writers from sharing an output tree.
Testing
cargo test -p spacetimedb-cli backup_restore --lib(30 passed)cargo test -p spacetimedb-engine --lib(55 passed, 1 ignored)cargo test -p spacetimedb-snapshot --lib(6 passed)cargo test -p spacetimedb-core hot_backup --lib(11 passed)cargo test -p spacetimedb-standalone --lib(21 passed)cargo test -p spacetimedb-client-api --lib(41 passed)cargo test -p spacetimedb-fs-utils(16 passed)--lib --tests -- -D warningscargo fmt --all -- --checkgit diff --check upstream/master...HEAD