#6519·ubicloud

Non-HA Postgres recovery blocks on backup size gate during storage scale down

Author: furkansahinCreated Sep 24, 2026Updated Sep 28, 2026

When the primary of a non-HA Postgres resource goes offline during a storage scale down, ConvergePostgresResource can stop in start and never provision a replacement. The resource then stays unavailable until an operator steps in.

Scenario

Treat the numbers as percentages of the current disk.

  • The non-HA server has 100 storage, uses 35, and the latest backup is 45.
  • The user requests a scale down to 50.
  • The primary goes offline.

What happens

  1. The primary hops to unavailable and sets recycle_unavailable_server, which starts ConvergePostgresResource. The scale down request starts it too.
  2. In start, latest_backup_too_large_for_target? uses representative_server. That is still the offline primary, which has 100. The target is 50 and 50 < 100, so the headroom applies and the limit is 50 * 0.8 = 40. The backup is 45 and 45 > 40, so the prog calls incr_take_backup_for_converge and naps.
  3. PostgresTimelineNexus#take_backup connects over SSH to postgres_timeline.leader, which is the offline primary. The backup never finishes and the semaphore stays set.
  4. start naps on take_backup_for_converge_set? every 60 seconds. Nothing provisions a new server. The only signal is a page after the 6 hour deadline.

The bug is older than #6485: a backup of 55 against a target of 50 blocks without the headroom. #6485 adds the 0.8 scale down headroom to the guard, so the problem now starts at a backup above 80% of the target, not above 100%.

Root cause

Recovery depends on a new backup from a primary that cannot take one.

Possible fixes

  • Preferred: When the representative server is unavailable, provision the replacement at the current size (representative_server.storage_size_gib) and not at target_storage_size_gib. Recovery then does not depend on the backup size. A normal convergence does the scale down after recovery. This needs a storage size override in provision_new_standby.
  • Skip the backup size gate when the leader is unavailable, because a new backup is not possible. This is a smaller change, but the restore can still fail on the smaller disk when the backup is close to or above the target size.