Skip to content

History and undo

Tenax keeps a history of every target, the way git keeps the history of a repository. Every full backup and every restore becomes a commit: who did it, when, why, which backup and which point in time. You can read the history, name the points that matter with tags, and undo an in-place restore.

How the history is built

  • main is the history of the live database. Each full backup adds a commit to it. An in-place restore adds a commit too, whose parents are the restored backup and the state it replaced.
  • restore/<name> records a restore into a sandbox or a new database. It does not touch main, because the live database did not change.
  • tags/<name> are names you give to commits, for example pre-migration.

Commits are small JSON objects stored next to your backups, under <target>/history/. Each one is identified by the SHA-256 of its content, so it cannot be edited without changing its ID. Every move of a ref is a new, numbered entry that records the previous entry's hash: the log is a hash chain, and tenax reflog checks it.

The history needs no setup. The controller records new backups within a few minutes and restores when they finish. After an upgrade to 0.7 it also records the backups you already have, oldest first.

Read the history

tenax history team/app
COMMIT        KIND     POINT                 BACKUP                    DESTINATION       BY    REASON                REFS
4c1e0b7a9d23  restore  2026-10-20 14:02:58   20261020T020000Z-a1b2c3   in-place:app      ana   invoices wiped        main
9f2d61c0e8b4  backup   2026-10-20 14:29:41   20261020T142941Z-77aa10   -                 ana   safety                -
...

POINT is the moment the data is consistent at; for a point-in-time restore it is the recovery target. A backup that retention has deleted is marked (deleted): its commit stays, so the history stays complete.

Every move of a ref, with who moved it and why:

tenax reflog team/app                       # main
tenax reflog team/app --ref tags/pre-migration

If the log has been tampered with, tenax reflog exits with an error that names the first entry that does not match.

Name a point

tenax tag team/app 9f2d61c0e8b4 pre-migration --reason "before the v2 schema"

The commit ID can be shortened to any unique prefix of at least 7 characters. Moving a tag to another commit adds an entry to its log; the old position is never lost.

Undo an in-place restore

An in-place restore takes a safety backup first. tenax undo restores that state again, in place:

tenax undo team/app --confirm app --credentials-secret tenax-admin --reason "restored the wrong point" --wait

Undo is an ordinary in-place restore, with the same safeguards: it needs the restorer-admin role, the target name as confirmation, an admin credentials secret in the target's namespace and a reason, and it takes a new safety backup before it starts. So an undo can be undone too.

If the in-place restore skipped its safety backup (--skip-safety-backup), undo restores the newest backup taken before it, and anything written after that backup is not part of the undo.

API

Operation Role
GET /api/v1/targets/{ns}/{name}/history viewer
GET /api/v1/targets/{ns}/{name}/reflog?ref=main viewer
POST /api/v1/targets/{ns}/{name}/tags operator
POST /api/v1/targets/{ns}/{name}/undo restorer-admin