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
- The primary hops to
unavailableand setsrecycle_unavailable_server, which startsConvergePostgresResource. The scale down request starts it too. - In
start,latest_backup_too_large_for_target?usesrepresentative_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 callsincr_take_backup_for_convergeand naps. PostgresTimelineNexus#take_backupconnects over SSH topostgres_timeline.leader, which is the offline primary. The backup never finishes and the semaphore stays set.startnaps ontake_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 attarget_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 inprovision_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.
Source: ubicloud/ubicloud