Skip to content

Document RocksDB backup & restore operations - #590

Open
cb1kenobi wants to merge 8 commits into
mainfrom
docs/rocksdb-backup-operations
Open

Document RocksDB backup & restore operations#590
cb1kenobi wants to merge 8 commits into
mainfrom
docs/rocksdb-backup-operations

Conversation

@cb1kenobi

@cb1kenobi cb1kenobi commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Documents the RocksDB backup & restore feature shipping in 5.2 (companion to HarperFast/harper#1831), in a dedicated Backups reference section:

  • Backups / Overview (reference/backups/overview.md) — how the backup system works (incremental managed backups, snapshot download), its limitations (engine support, granularity, single storage root, online-vs-offline restore matrix), and two worked examples: incremental backup/restore with harper create_backup / harper restore_backup, and harper get_backup streaming a tar.gz off-host plus the manual restore procedure (stop Harper, extract into the database directory under storage.path).
  • Backups / Operations (reference/backups/operations.md) — all seven operations (create_backup, list_backups, verify_backup, delete_backup, purge_backups, restore_backup, get_backup) with Operations API and CLI examples.
  • EngineBadge component (src/components/EngineBadge.tsx, globally registered like VersionBadge) tags storage-engine support per operation: the managed operations are RocksDB-only; get_backup supports both RocksDB and LMDB.
  • Operations API (reference/operations-api/operations.md) — Backup & Restore trimmed to the brief index pattern used by Logs/Certificate Management, linking to the new section.
  • CLI (reference/cli/commands.md) — the Backup Commands section is removed (content lives in Backups now); the backup operations are listed in the CLI operations table (reference/cli/operations-api-commands.md).
  • Configuration (reference/configuration/options.md) — the backupPath storage option (default <rootPath>/backup).
  • Release notes (release-notes/v5-lincoln/5.2.md) — Backup & Restore entry, linking to the new section.

Where to look

  • The manual-restore example in the Overview instructs extracting the archive into <storage.path>/<database> (default ~/hdb/database/data) — path verified against DATABASES_DIR_NAME in core and rocksdb-js's tar layout (entries unpack directly into a directory that opens as a RocksDB database, including transaction_logs/). Worth a second pair of eyes since a wrong path here damages user data.
  • Cross-model review (Codex) surfaced four accuracy issues, all fixed in this branch: the whole-database claim now carves out LMDB get_backup partial exports, the single-root-store restriction is documented as a limitation, the super_user requirement is scoped to server-invoked operations (offline CLI is filesystem-governed), and LMDB manual restore points at storage.path rather than the default-only path. The Gemini review leg failed to run (headless permission denial), so outside-model coverage is Codex-only.
  • EngineBadge prop shape is a comma-separated string (engines="RocksDB, LMDB") rendered in the same style as VersionBadge — open to a different design.

Reviewers not assigned — leaving that to you.

Generated by an LLM (Claude Fable 5).

🤖 Generated with Claude Code

cb1kenobi and others added 2 commits July 16, 2026 02:12
Covers the new backup/restore Operations API operations (create_backup, list_backups,
verify_backup, delete_backup, purge_backups, restore_backup) and RocksDB support for
get_backup (gzipped-by-default tar; gzip=false for plain tar; remote target support).
Documents when a database can be restored online vs offline (system db and
component-held dbs require the server stopped), the backupPath storage option, and the
5.2 release note.

Companion to HarperFast/harper#1831.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…perations

# Conflicts:
#	release-notes/v5-lincoln/5.2.md
gemini-code-assist[bot]

This comment was marked as resolved.

@github-actions
github-actions Bot temporarily deployed to pr-590 July 16, 2026 07:17 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

Companion to HarperFast/harper#1831.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pr-590 July 16, 2026 07:59 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

…_count)

Matches HarperFast/harper#1831, which now returns snake_case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pr-590 July 16, 2026 15:12 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

Backups now has its own sidebar section with an Overview (how the system
works, limitations, worked examples for incremental backup/restore and
get_backup snapshot download + manual restore) and an Operations page
(all seven operations with Operations API and CLI examples).

- Add EngineBadge component (globally registered, like VersionBadge) to
  tag storage-engine support: managed ops are RocksDB-only, get_backup
  supports RocksDB and LMDB
- Remove the Backup Commands section from the CLI commands page; leave a
  pointer next to the volume-snapshot guidance
- Trim operations-api Backup & Restore to the brief index pattern used
  by Logs/Certificate Management, linking to the new section
- Add the backup operations to the CLI operations table
- Drop the hyphenated-alias mention entirely

Cross-model review (Codex) fixes: scope the whole-database claim and
super_user requirement, document the single-root-store restriction, and
point LMDB manual restore at storage.path rather than the default path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pr-590 July 17, 2026 16:25 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

1 similar comment
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

@github-actions
github-actions Bot temporarily deployed to pr-590 July 23, 2026 20:36 Inactive
@github-actions
github-actions Bot temporarily deployed to pr-590 July 23, 2026 23:19 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

@github-actions
github-actions Bot temporarily deployed to pr-590 July 27, 2026 19:48 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

- overview: split manual snapshot restore into RocksDB (tar) and LMDB
  (.mdb) examples; mark the RocksDB walkthrough as engine-specific
- cli/commands: frame "How Backups Work" as a per-engine choice (volume
  snapshots for LMDB, RocksDB backup engine for RocksDB) and scope the
  atomic-snapshot requirement to LMDB
- operations-api: move Backup & Restore section down into the
  operational cluster (after System, before Jobs)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

@github-actions
github-actions Bot temporarily deployed to pr-590 July 27, 2026 23:23 Inactive
@cb1kenobi
cb1kenobi marked this pull request as ready for review July 28, 2026 15:42
@cb1kenobi
cb1kenobi requested a review from a team as a code owner July 28, 2026 15:42
- **One storage root per database.** A database whose tables use per-table `path` storage configs spans multiple root stores and cannot be backed up with these operations.
- **Backups live on the node that created them.** The backup repository is a local directory. For disaster recovery, copy backup directories off-host, or use `get_backup` to pull snapshots from a running server.
- **`get_backup` always streams the current state.** It cannot download a historical managed backup; to move a retained backup off-host, copy its backup directory.
- **A restore is a point-in-time rollback.** In a replicated cluster, coordinate a restore with replication before bringing the node back.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: no documented recovery step for a crashed/interrupted restore

restore_backup is destructive (purge-then-copy). If it's interrupted partway — process crash, power loss, disk error — the implementation leaves a .restoring marker next to the database directory and refuses to load that database on the next harper start (logged as an error: "Incomplete restore ... not loading it — rerun the restore to recover"). None of this is mentioned here or in operations.md: a reader who hits this after an interrupted restore has no way to know from the docs that the fix is simply to rerun restore_backup (same backup_id), not that data is lost or the install is broken.

Suggested fix: add a bullet to Limitations (or a short note under "When can a database be restored?"), e.g. "If restore_backup is interrupted before completing (crash, power loss), the affected database is left unloadable — Harper logs an incomplete-restore error and skips it on startup. Rerun restore_backup for the same database (and backup_id, if you passed one) to recover; do not attempt to load or manually repair the directory."


Generated by Barber AI

Comment thread reference/backups/operations.md Outdated

Through a running server this runs as a background [job](../operations-api/operations.md#jobs): Harper closes the database across all worker threads, restores it, and reloads it. This works only when no loaded component is holding the database open — restoring the `system` database, or a database a component keeps open, requires running the command from the CLI with the server stopped. See [when can a database be restored?](./overview.md#when-can-a-database-be-restored)

From the CLI with the server stopped, `target_database=<name>` restores into a new database instead of overwriting the source. The target must not already exist; Harper picks the new database up on the next start.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low: target_database constraint is stated more strictly than the implementation

"The target must not already exist" isn't quite what restoreBackupOffline enforces — it accepts an existing empty directory too (isMissingOrEmptyDir), rejecting only a non-empty one. Not harmful (following the doc's advice always works), but a reader with an empty leftover directory under that name would incorrectly conclude they need to pick a different name.

Suggested fix: "The target must not already exist (or must be empty); Harper picks the new database up on the next start."


Generated by Barber AI

@kriszyp kriszyp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, sorry, I messed up the first review, I got the PR for docs and code confused. This looks good. I guess I will leave in the inline comments in place.

Comment thread reference/backups/overview.md Outdated
Comment thread reference/backups/operations.md Outdated
Comment thread reference/backups/overview.md Outdated
Comment thread reference/backups/operations.md Outdated
Comment thread reference/backups/overview.md Outdated

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-verified @kriszyp's five inline comments against harper#1831's current head — all five still stand, so this needs another round regardless. On top of those, one finding of my own that I'd treat as the blocker: blobs are undocumented end to end, and the snapshot-restore example silently loses blob data for any database with file-backed blobs.

get_backup's tar now carries blobs/<rootIndex>/<relpath> entries. The documented tar -xzf … -C ~/hdb/database/data extracts those inside the RocksDB directory, restoring no blobs to their real roots — a user follows the docs, gets a clean-looking restore, and has lost blob data. exclude_blobs, blob snapshots in managed backups, and blob purge-and-rewrite on restore are all missing, and the "all tables plus the audit/transaction log" scope line plus the 5.2 release-notes entry need the blob carve-in too.

One process note: your CHANGES_REQUESTED summary on this PR says "This looks good" — I think that landed on the wrong PR, since the inline comments are substantive. Either way a re-request will be needed to clear the state.

And the ordering question: #1831's blob work is itself under CHANGES_REQUESTED from kriszyp. These docs should re-sync once that settles — is a final drift pass planned before merge?

sent with Claude Opus 5

Comment thread reference/backups/overview.md
Comment thread reference/backups/overview.md Outdated
Comment thread reference/backups/overview.md Outdated
Comment thread reference/backups/overview.md Outdated
Comment thread reference/backups/operations.md Outdated
Comment thread reference/backups/operations.md Outdated
Comment thread reference/backups/operations.md Outdated
Comment thread reference/backups/overview.md
…emantics)

Address PR #590 review feedback (kriszyp, Ethan-Arrowood), verified
against harper#1831 head:

- Blobs (blocker): document that get_backup's tar and managed backups
  include file-backed blobs; add a correct manual snapshot-restore
  procedure that restores blob roots separately (the naive single-extract
  recipe silently lost blob data); cover exclude_blobs and restore's
  blob purge-and-rewrite; carve blobs into the scope line and 5.2 notes
- DR copy: backups share files across IDs — copy the whole per-database
  repository while quiesced, not a single backup dir
- verify_backup: scope to RocksDB files + tx-log framing; blobs unverified
- Incremental cost: tx-log and blob snapshots are copied in full each
  backup (not incremental)
- restore_backup: online open-DB failure is job status ERROR (not HTTP
  409); system/target_database rejected synchronously; target may be an
  empty dir; document interrupted-restore recovery (rerun restore_backup)
- list_backups: define timestamp/size/file_count and note they exclude
  tx-log/blob snapshots
- get_backup: note it can clone a database from another node via target

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cb1kenobi

Copy link
Copy Markdown
Member Author

Thanks @kriszyp and @Ethan-Arrowood — this was a genuinely useful round. All inline comments are addressed in b2d6053, verified against harper#1831's current head (which has had significant blob rework since the earlier reviews):

  • Blobs (blocker): get_backup's tar and managed backups now document the file-backed blob snapshot; the manual RocksDB restore restores blob roots separately (the old single-extract recipe silently dropped blobs), and exclude_blobs + restore's blob purge-and-rewrite are covered. Blobs are carved into the scope line and the 5.2 notes.
  • DR copy / verify scope / incremental cost / list_backups fields / restore ERROR vs 409 / target_database empty-dir / interrupted-restore recovery — all corrected; details in the individual thread replies.

One thing worth a second look: against #1831's current head the transaction-log snapshot is verified (a framing check, always), so the only unverified part is the blob snapshot. The docs now reflect that rather than the earlier "tx-log is never checked" framing — please confirm that matches your reading of backups.verify.

On the ordering question: this pass is the re-sync against #1831's reworked blob handling. Since #1831 is still moving, I'll do a final drift check against its head just before merge. Re-requesting review to clear the state.

— Generated by Barber AI

@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-590

This preview will update automatically when you push new commits.

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.

3 participants