Skip to content

Design the backup-first native takeover - #517

Merged
rmcdaniel merged 11 commits into
mainfrom
rust-325-takeover-design
Oct 20, 2026
Merged

rmcdaniel merged 11 commits into
mainfrom
rust-325-takeover-design

Conversation

@rmcdaniel

@rmcdaniel rmcdaniel commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Part of #325: the backup-first in-place upgrade gate.

The storage audit lists the upgrade gates, and the merged inspection commands (#460) keep backup_verified, php_quiescence_verified, stored_representation_compatibility_verified and takeover_allowed false. This adds docs/rust-server-upgrade-takeover.md, a design input (not a contract change or a qualified procedure) for what turns each one true:

  • Backup proof. A fingerprint of the database's complete logical contents is compared between the stopped source and its backup restored into a separate database, then checked again inside the takeover's own exclusive transaction before the ownership marker is written. A write after the backup stops the takeover before any mutation.
  • Writer exclusion and atomicity per backend. SQLite and PostgreSQL commit fingerprint check, marker and schema changes in one transaction. MySQL and MariaDB commit DDL implicitly, so the marker carries a step journal; their exclusion method is an open question.
  • Interruption. Native startup refuses a marker still in takeover. A rerun with the same fingerprint resumes after the last recorded step; a different fingerprint is refused.
  • Layout conversion. Native's frozen layout predates PHP 2.8.0 and 2.9.7, which add their own registration-incarnation table and token, a service-call deadline column and a queue delivery reference. Native keeps its own layout. Takeover converts each qualified PHP release's layout to it with a recorded recipe (copy incarnations and tokens, drop delivery-only columns after checking them, refuse service calls), and refuses releases without a recipe.
  • Preconditions and tests. The source runs Server 2.5.14 or later (the first release with the PHP ownership fence) and passes every inspection; takeover refuses external payload references until a qualified object check exists. The per-backend upgrade fixtures and checks follow the assignment's requirements.

Implementation follows in separate PRs, SQLite first.

🤖 Generated with Claude Code

durable-workflow-ops and others added 4 commits October 20, 2026 08:02
The storage audit lists the takeover gates, and the inspection commands keep
their backup, quiescence, compatibility and takeover flags false. This note
proposes what turns each one true:

- a fingerprint of the database's complete logical contents, compared
  between the stopped source and a restored backup, then checked again
  inside the takeover's own exclusive transaction before the marker is
  written;
- per-backend writer exclusion and atomicity, with a marker step journal
  where DDL commits implicitly;
- resumption of an interrupted takeover from the marker, refusal of a
  different fingerprint, and the per-backend upgrade fixtures and checks.

It records what is not yet known, such as MySQL's exclusion method.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
durable-workflow-ops and others added 3 commits October 20, 2026 10:45
PHP grants queue_delivery_reference no task authority, and the queue
inspection already binds every queued job to its task row, so the
conversion removes the column and reports how many references it held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PostgreSQL locks every table in ACCESS EXCLUSIVE mode after native's
bootstrap key, since the later DDL needs that mode anyway. On SQLite and
PostgreSQL the marker commits with everything else, so an interrupted
takeover is simply rerun; only MySQL and MariaDB need the step journal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
durable-workflow-ops and others added 3 commits October 20, 2026 12:42
MySQL and MariaDB use native's bootstrap lock and a session check rather
than LOCK TABLES, which refuses to create or drop tables it does not hold.
Their journal is a rust-takeover row in native's marker table. A SQLite
source in PHP's default WAL mode is first switched to the rollback journal
with upgrade-prepare-sqlite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel merged commit 83f4d6b into main Oct 20, 2026
9 checks passed
@rmcdaniel
rmcdaniel deleted the rust-325-takeover-design branch October 20, 2026 14:15
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