Skip to content

mariadb backup: a RestoreJob restores the newest dump in the prefix, whichever Backup it names #5196

Closed

Description

@myasnikovdaniil

Describe the bug

A RestoreJob that names a MariaDB Backup does not restore the dump of that Backup. The driver creates k8s.mariadb.com/Restore with backupRef set to the operator Backup and no targetRecoveryTime, mariadb-operator takes the storage settings from that Backup and restores the newest backup.<timestamp>.<alg>.sql it finds in the prefix before the restore started. With the default strategy every backup of an app shares the prefix <namespace>/<app>/, so any RestoreJob restores the latest dump.

Environment

Cozystack v1.7.0, mariadb-operator 25.10.2.

To reproduce

  1. MariaDB app m1 with row 1, run BackupJob A.
  2. Insert row 2, run BackupJob B.
  3. Create a RestoreJob with backupRef: <A> into an empty second MariaDB app (to-copy).

Actual behaviour

The second app has rows 1 and 2. The operator Restore pod log:

{"msg":"obtained target time","time":"2026-11-04 08:48:46 +0000 UTC"}
{"msg":"obtained target backup","file":"<namespace>/m1/backup.2026-11-04T08:47:17Z.gzip.sql"}

That is the dump of B (08:47:17), the dump of A was taken 08:46:43. Same when the dump of A is already gone: RestoreJob from A still ends Succeeded and restores the newer dump.

Expected behaviour

Restore uses the dump of the Backup it names, or fails when that dump is gone.

I think the driver has to resolve the dump that belongs to the operator Backup and pass its timestamp as targetRecoveryTime, or use a prefix per Backup. #3549 is about restore options in general, not this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)kind/bugCategorizes issue or PR as related to a bugtriage/needs-triageIndicates an issue needs triage by a maintainer

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions