Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

14.2 KB
Raw Blame

1. Client bundles

Every bundle task lands both architectures of one bundle, then verifies the binaries by running them inside the runtime base image. The verification command for an amd64 tree is:

docker run --rm --platform linux/amd64 -v "$PWD/assets/tools:/tools:ro" debian:bookworm-slim \
  bash -c 'apt-get update -qq && apt-get install -y -qq libedit2 libncurses6 libtinfo6 libssl3 >/dev/null && \
           /tools/x64/<engine>/<bundle>/bin/<command> --version'

The arm64 tree cannot be executed on an amd64 host without emulation; tasks 3.1 and 3.2 make the product itself verify it at startup on a real arm64 build.

  • 1.1 Add assets/tools/{x64,arm}/mysql/mysql-26/bin/{mysql,mysqldump} from https://cdn.mysql.com/Downloads/MySQL-26.7/mysql-26.7.0-linux-glibc2.28-{x86_64,aarch64}.tar.xz, strip the binaries, and verify the x64 pair reports 26.7.0 under the command above
  • 1.2 Refresh assets/tools/{x64,arm}/mysql/mysql-9/bin/ from mysql-9.7.2-linux-glibc2.28-{x86_64,aarch64}.tar.xz at the same download host, and verify the x64 pair reports 9.7.2
  • 1.3 Refresh assets/tools/{x64,arm}/mysql/mysql-8.4/bin/ from mysql-8.4.11-... and mysql-8.0/bin/ from mysql-8.0.46-..., and verify each x64 pair reports its new patch
  • 1.4 Confirm mysql-5.7 already carries 5.7.44, the final patch of that line, and leave it unchanged; record the check in assets/tools/README.md rather than touching the binaries
  • 1.5 Add assets/tools/{x64,arm}/mariadb/mariadb-13.0/bin/{mariadb,mariadb-dump} from the vendor's Ubuntu jammy packages https://mirror.mariadb.org/repo/13.0/ubuntu/pool/main/m/mariadb/mariadb-client{,-core}_13.0.2+maria~ubu2204_{amd64,arm64}.deb — mariadb-dump ships in mariadb-client, mariadb in mariadb-client-core — and verify the x64 pair reports 13.0.2-MariaDB
  • 1.6 Replace assets/tools/{x64,arm}/mariadb/mariadb-12.1/ with mariadb-12.3/ built from https://mirror.mariadb.org/repo/12.3/debian/ for bookworm on both architectures, and verify the x64 pair reports 12.3.3-MariaDB
  • 1.7 Refresh assets/tools/{x64,arm}/mariadb/mariadb-10.6/bin/ to 10.6.28 from https://mirror.mariadb.org/repo/10.6/ubuntu/ for jammy on both architectures, so both architectures carry the same build; today they do not — the x64 copy comes from the architecture-independent tarball and reports 10.6.21, while the arm copy comes from distribution packaging and carries a 10.11 version string, which the refresh resolves. Verify the x64 pair reports 10.6.28-MariaDB
  • 1.8 Generalise tools/refresh-mariadb-x64-libedit.sh into one script covering tasks 1.5 to 1.7. It takes the exact package version, the vendor repository (Debian bookworm for 12.3, Ubuntu jammy for 13.0 and 10.6) and the target architecture, since those three differ per bundle. Pin the package version rather than installing the newest patch of a line, otherwise the result changes with upstream. For arm64 it downloads the .deb and unpacks it with dpkg-deb -x instead of apt-get install under --platform linux/arm64, because the development host has no emulation and unpacking needs none. Verify by re-running it for one already-committed bundle and confirming sha256sum matches the committed binaries
  • 1.9 Verify every new and refreshed binary is recorded executable in the index: git ls-files -s assets/tools | grep -v '^100755' | grep -E 'mysql|mariadb' prints nothing
  • 1.10 Verify every bundle now holds the version its directory name claims, which assets/tools/arm/mariadb/mariadb-10.6/ does not today — it reports 10.11.14-MariaDB. For each bundle, read the version out of the binary (--version on x64, strings on the arm tree) and confirm it starts with the bundle's line: mariadb-10.6 → 10.6.x, mariadb-12.3 → 12.3.x, mariadb-13.0 → 13.0.x, mysql-26 → 26.x
  • 1.11 Measure what the change costs the CI runner before relying on it: du -sh assets/tools/{x64,arm} for the tree, and docker pull followed by docker image ls for mysql:26.7, mariadb:13.0, mariadb:5.5 and mariadb:10.1. The pre-pull step in .github/workflows/ci-release.yml:250-256 already frees ~11 GB to fit ~19 GB of images and says the fit is tight; if the new images no longer fit, extend that step's cleanup in the same change

2. Version identity and client selection

  • 2.1 Add the MySQL 26 identity and its bundle to backend/internal/util/tools/mysql.go, and make bundle resolution report whether the bundle for the running architecture is present instead of returning a path that may not exist; verify with go test ./internal/util/tools/... -count=1
  • 2.2 Extend MySQL version detection in backend/internal/features/databases/databases/mysql/model.go so every 26.x server maps to the 26 identity, whatever its minor, and keep every unserved major refused with a message listing the supported versions. Leave mapMysql8xVersion as it is: major 8 is closed at 8.4, so its fallthrough has nothing left to mis-route. Verify with go test ./internal/features/databases/... -count=1
  • 2.3 Add the MariaDB 13 server identity and a 13.0 client tier in tools/mariadb.go, extend detection in mariadb/model.go so every 13.x server maps to the 13.0 identity, and route that identity to the new tier. A 13.2 server is accepted by the 13.0 client because they share a release line; a 14.x server is refused because no 14 client ships. Verify with go test ./internal/features/databases/... -count=1
  • 2.4 Refuse a version whose client is absent for the running architecture at the connection test, naming the architecture, which is what MySQL 5.7 on arm64 needs; today that case resolves to a missing path and fails when a backup runs; verify with go test ./internal/features/databases/... -count=1
  • 2.5 Replace the version-order maps behind the restore downgrade guard in tools/mysql.go and tools/mariadb.go with a comparison that parses the numbers in the identity, so a newly added identity orders correctly without a table entry and an unparseable identity returns an error instead of ordering as zero; cover both new identities; verify with go test ./internal/features/restores/... ./internal/util/tools/... -count=1
  • 2.6 Extend the compression candidate selection in backend/internal/features/backups/backups/usecases/logical/mysql/compression_probe.go so every identity above 5.7 negotiates from the modern algorithm set, and make the 5.7 path explicit rather than a fallthrough; verify with go test ./internal/features/backups/... -count=1
  • 2.7 Delete GetMysqlVersionEnum and GetMariadbVersionEnum, which have no callers anywhere including tests, so the new identities do not have to be added to code nothing reads; verify with make lint and go build ./...

3. Startup and health verification

  • 3.1 Change the client check in backend/internal/util/tools/common.go to execute each client's version flag instead of only checking presence and the executable bit, keeping the existing fatal tier for PostgreSQL and the warning tier for the others; verify with go test ./internal/util/tools/... -count=1 and by starting the backend with a bundle directory temporarily renamed, which must produce a warning naming that bundle
  • 3.2 Compare the version each client prints with the release line its bundle is registered under, and report a mismatch as a failure of that bundle. The output formats differ per engine and the MariaDB one carries two numbers — mariadb-dump ... from 12.1.2-MariaDB, client 10.19 ..., where the bundle's line is the one before -MariaDB — so parse per engine rather than taking the first number found. Verify with go test ./internal/util/tools/... -count=1, including a case that pins a bundle holding a foreign version as a failure
  • 3.3 Keep the execution and version comparison to once per process and have ClientToolsHealthError report the cached verdict, re-checking only that the files are still present. The container probes the endpoint every 30 seconds with a 5 second timeout (Dockerfile:204), and running roughly 38 client binaries per probe is how a loaded host reports a false unhealthy. Verify with go test ./internal/util/tools/... -count=1 and by confirming that deleting a bundle directory under a running backend still degrades the health endpoint
  • 3.4 Add the new bundles to the lists the check walks in tools/mysql.go and tools/mariadb.go, and confirm a clean start reports every bundle verified
  • 3.5 Extend the libedit.so.2 shim in backend/Makefile:19-29 from test-fedora to a run-fedora target, since running the binaries makes the check fail for the MariaDB clients on a host that ships libedit.so.0; verify by starting the backend on such a host and seeing MariaDB reported as verified rather than disabled

4. Frontend

  • 4.1 Delete the version label maps in frontend/src/features/databases/ui/show/Show{MySql,MariaDb}SpecificDataComponent.tsx and render the recorded identity string directly, so an identity the release does not know about displays as itself rather than as an empty value; verify with pnpm lint, pnpm test and pnpm build in frontend/
  • 4.2 Add the new identities to frontend/src/entity/databases/model/mysql/MysqlVersion.ts and mariadb/MariadbVersion.ts, keeping the enumeration as the type of the version field since the set of identities is closed; verify with pnpm lint and pnpm build in frontend/
  • 4.3 Confirm the two new identities survive the whole path: add a MySQL 26 database and a MariaDB 13 database against real servers and confirm each view shows its version rather than an empty field. The version field is an unconstrained string in the API schema, so make swagger has nothing to regenerate here

5. Tests against real servers

  • 5.1 Add mysql:26.7 to the matrix in backend/internal/features/databases/databases/mysql/model_test.go and mariadb:13.0 to mariadb/model_test.go, covering connection, privilege detection and read-only user creation; verify with go test ./internal/features/databases/... -count=1
  • 5.2 Add the same two images to the backup and restore matrices in backend/internal/features/tests/logical/{mysql,mariadb}/backup_restore_test.go, including the encryption, exclude-tables and read-only-user cases the neighbouring versions run; verify with go test ./internal/features/tests/logical/mysql/... ./internal/features/tests/logical/mariadb/... -count=1
  • 5.3 Add mariadb:5.5 and mariadb:10.1 to both MariaDB matrices, which today start at 10.6 and therefore never exercise the legacy client tier at all — the tier whose arm64 bundle holds a 10.11 binary. Skip the subtests those servers genuinely cannot run, the way the matrix already gates runsRoutineGrantTest, rather than dropping the versions. Verify with go test ./internal/features/databases/... ./internal/features/tests/logical/mariadb/... -count=1
  • 5.4 Add cases asserting the refusals on both engines: a MySQL major above 26 and a MariaDB major above 13 are refused with a message listing the supported versions, and a version whose client is absent for the running architecture is refused naming the architecture; verify with go test ./internal/features/databases/... -count=1
  • 5.5 Add mapping cases for the other half of the rule: a MariaDB 13.2 server records the 13.0 identity and a MySQL 26.10 server records the 26 identity, so a later release inside a served line stays accepted; verify with go test ./internal/features/databases/... -count=1
  • 5.6 Add restore guard cases asserting that a backup from MySQL 26.x is refused onto 9.x and 8.x, and a backup from MariaDB 13.x onto 12.x; verify with go test ./internal/features/restores/... -count=1
  • 5.7 Add a case pinning the behavior from issue #786 — a server whose version string carries a vendor suffix such as 26.7.0-cloud is accepted — which is the one place an issue number belongs in the tests; verify with go test ./internal/features/databases/... -count=1

6. Documentation

  • 6.1 Update assets/tools/README.md: the bundle layout and the per-bundle version table for MySQL and MariaDB, the download source of every bundle, the shared libraries the binaries need from the runtime image, and the note that libedit.so.2 reaches the image only as a dependency of postgresql-common
  • 6.2 Add assets/tools/AGENTS.md carrying the checklist for adding a new engine version and for refreshing a patch level, using the draft in this change at assets-tools-agents-draft.md as the starting content
  • 6.3 Update the supported-version lines in README.md and in all five copies assets/readme/README.{es,fr,pt,ru,zh}.md, as assets/readme/AGENTS.md requires; each list sits at lines 115-116 of its file, and the Chinese copy uses its own list punctuation. Three edits, not one: add the new versions, mark MySQL 5.7 as x86-64 only now that arm64 refuses it, and correct the MariaDB line, which reads "10, 11 and 12" while the product also accepts 5.5
  • 6.4 Update the MySQL landing page on the website, which states the supported versions in six languages: website/app/(en)/mysql-backup/page.tsx and the five copies under website/app/[lang]/mysql-backup/content/. Each copy repeats the list in five places — the feature bullets, the JSON-LD FAQ entry, the prose in the compatibility section, the per-version cards, and the visible FAQ answer — and website/AGENTS.md requires the visible FAQ and its JSON-LD copy to agree, so find them with grep -rn '5\.7\|MariaDB 1' website/app/*/mysql-backup rather than by line number. Verify with npm run lint and npm run build in website/, the commands website/AGENTS.md names

7. Whole-suite verification and review

  • 7.1 Run make lint for the backend, pnpm lint and pnpm format in frontend/, and npm run lint in website/, and fix every finding
  • 7.2 Run the whole backend suite once, at the end, with make test or make test-fedora on a Fedora host, since it recreates the shared containers and database slots other agents draw from. Four new containers join the run against a -timeout 15m budget (backend/Makefile:16); if the suite now exceeds it, raise the budget in the same change rather than dropping matrix cases
  • 7.3 Resolve every CHANGES REQUIRED finding from the mandatory post-implementation review, and leave the working tree ready to commit