A RestoreJob created a mariadb-operator Restore that named only the
operator Backup. The operator then lists the prefix that Backup wrote
to and restores the dump nearest to the moment the restore started:
the application's newest dump, not the one the Backup was taken as.
When the Backup records its dump, the Restore now carries the
timestamp in that dump's name as targetRecoveryTime. mariadb-operator
returns the dump whose timestamp equals the target before it looks for
the nearest one, and the nearest one is exactly what it would restore
if the recorded dump were gone. So the controller first checks, with
its own bounded call, that the dump is still in the operator Backup's
storage. A dump that is gone fails the RestoreJob, naming the dump,
instead of restoring a neighbour in its place. A check that cannot be
made keeps the RestoreJob waiting with Ready=False until the restore
deadline, then fails it with the cause: the Backup could record its
dump only because the controller reached that storage when it was
taken, so an unreachable storage is not a reason to guess.
The dump is chosen once, as the operator Restore is created; a Restore
that already exists is followed as before.
Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>