Skip to content

fix(backup): set pending phase when backup is waiting to be processed#9364

Merged
mnencia merged 1 commit intomainfrom
dev/backup-pending
Dec 17, 2025
Merged

fix(backup): set pending phase when backup is waiting to be processed#9364
mnencia merged 1 commit intomainfrom
dev/backup-pending

Conversation

@armru
Copy link
Member

@armru armru commented Dec 3, 2025

When a backup is created but cannot be immediately processed (e.g., cluster not found, another backup is running, or target pod is not ready), the backup's phase should be set to "pending" to indicate its state to users.

Previously, the backup phase could remain empty in these scenarios, which was misleading as users couldn't distinguish between a backup that hadn't started processing and one that was actively waiting.

This change:

  • Adds a SetAsPending() method to BackupStatus for consistency with other SetAs* methods (SetAsStarted, SetAsCompleted, SetAsFailed)
  • Updates getCluster() to set pending when the target cluster is not found
  • Updates waitIfOtherBackupsRunning() to set pending when another backup for the same cluster is already running or waiting
  • Ensures startBackupManagedByInstance() and reconcileSnapshotBackup() use the new SetAsPending() method instead of direct phase assignment

@armru armru requested a review from a team as a code owner December 3, 2025 14:00
@armru armru added no-issue do not backport This PR must not be backported - it will be in the next minor release labels Dec 3, 2025
@armru
Copy link
Member Author

armru commented Dec 3, 2025

/test

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/19896446945

@dosubot dosubot bot added bug 🐛 Something isn't working ok to merge 👌 This PR can be merged labels Dec 3, 2025
Copy link
Contributor

@gabriele-wolfox gabriele-wolfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leonardoce
Copy link
Contributor

I tested it with the in core barman-cloud support and with the plugin and the patch works beautifully.
It looks fine to me.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 16, 2025
When a backup is created but cannot be immediately processed (e.g.,
cluster not found, another backup is running, or target pod is not
ready), the backup's phase should be set to "pending" to indicate
its state to users.

Previously, the backup phase could remain empty in these scenarios,
which was misleading as users couldn't distinguish between a backup
that hadn't started processing and one that was actively waiting.

This change:
- Adds a SetAsPending() method to BackupStatus for consistency with
  other SetAs* methods (SetAsStarted, SetAsCompleted, SetAsFailed)
- Updates getCluster() to set pending when the target cluster is not found
- Updates waitIfOtherBackupsRunning() to set pending when another
  backup for the same cluster is already running or waiting
- Ensures startBackupManagedByInstance() and reconcileSnapshotBackup()
  use the new SetAsPending() method instead of direct phase assignment

Signed-off-by: Armando Ruocco <[email protected]>
@mnencia mnencia merged commit dc841ad into main Dec 17, 2025
34 checks passed
@mnencia mnencia deleted the dev/backup-pending branch December 17, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐛 Something isn't working do not backport This PR must not be backported - it will be in the next minor release lgtm This PR has been approved by a maintainer no-issue ok to merge 👌 This PR can be merged size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants