Upgrades
Builds and store schema versions, a rolling upgrade, what refuses an unsafe mix of builds, rolling back, PostgreSQL's own upgrades, and the earlier server.
Builds and schema versions
mimicd version names a process's build: its version and the commit it was
built from, and the versions of the document core it links.
mimicd 1.0.0-dev+f502a155064b (vNext: PostgreSQL storage)
core: 0.3.2 (abi 18), core semantics [1 2], event formats [1 2], …What a deployment stores has a schema version. A process applies the schema migrations its build carries as it starts, on every store it is given, each in one transaction. There is no cluster version to finalize: a store is at the schema of the newest build that opened it. A process of an earlier build refuses to start on a store a later build migrated (exit code 5), and operator commands never migrate a store.
A rolling upgrade
Read what the build says
A build's notes (and the repository's mimicd/README.md, under Upgrading)
say what crossing each schema version takes. Most need nothing; a few need
every process of the earlier build stopped before a process of the new one
starts, because an earlier process would go on deciding on records it no
longer reads right. With Compose, that is docker compose down before
up; elsewhere, scale the earlier build to zero first.
Back up the stores
Take a PostgreSQL backup of every store you can return to: a schema migration is not undone by starting an earlier build.
Replace processes one at a time
Stop a process (SIGTERM: it hands its partitions over), start the new
build in its place, and wait until its /readyz answers 200 before the
next. The first process of the new build migrates each store as it opens
it; a migration that builds an index can hold that store's writes while it
runs, so upgrade in a quiet window where the build's notes say so.
What refuses an unsafe mix
While a process of an earlier build is live, a process of the new build
refuses what the earlier one cannot follow: new kinds of operations,
backups' first destination, fences, imports, triggers and migrations
(unavailable, naming the earlier processes). Session protocols 3 and 4,
and scoped sessions, are offered only while every live process serves them;
beside an earlier one, sockets negotiate protocol 2, and clients reconnect.
Once the earlier build's last process has left, the next beat offers them
again.
A process sees its peers through the registry in the home store. Every process registers there, a process without an internal listener marked as running alone, except one of a build before store schema version 30: a process of such a build without an internal listener is not registered, so nothing sees it. Stop such a process before a process of a new build starts.
Rolling back
Starting an earlier build in place of a later one works only while the later build has not migrated a store's schema. Past a migration, a process of the earlier build refuses the store (exit code 5): roll back by recovering the stores from the PostgreSQL backup taken before the upgrade, which loses what was written since.
PostgreSQL
A process needs PostgreSQL 16 or later. Upgrade PostgreSQL's major version
with its own tools (pg_upgrade, or a dump and a restore, or your
provider's upgrade). With the Compose file, another major version's image
keeps its data in another directory of the volume and starts an empty
cluster there, on which mimicd would found a new, empty deployment:
upgrade the data first.
From the earlier server
A deployment of the earlier server (release 0.x) is never upgraded in
place, and this server imports none of its data: it reads none of its data
directories, journals, object-store layouts or backups, and mimicd cutover
refuses its archives. That server is retired.