pg_upgradecluster and synchronous replication

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: pgsql-pkg-debian(at)lists(dot)postgresql(dot)org
Subject: pg_upgradecluster and synchronous replication
Date: 2026-01-14 17:50:00
Message-ID: d3f21029c8ea11f6a61cfb8045ac11480787411e.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-pkg-debian

I ran into a problem today during a training session when I demonstrated

pg_upgradecluster -v 18 --method=upgrade --link 17 main

The problem was that I had configured synchronous streaming replication first, so after
pg_upgrade, the synchronous standby was lost, and when pg_upgradecluster ran

vacuumdb ... --analyze-in-stages --missing-stats-only

processing hung, because the synchronous standby was not available and the transaction
could not commit.

Yes, that was my mistake, and yes, the problem was easily fixed by interrupting
pg_upgradecluster, disabling synchronous_standby_names and running the ANALYZE
and v17 cluster removal manually.

Yet I wonder if pg_upgradecluster could improve things by disabling synchronous_standby_names
when the cluster ist started for the "finish" stage. I have attached a POC patch how this
could be done. I didn't test it, and my Perl skills are marginal, but you get the idea.

Perhaps this is too much black magic, not sure. But I wanted to share my experience.

Yours,
Laurenz Albe

Attachment Content-Type Size
pg_upgradecluster-analyze.patch text/x-patch 672 bytes

Responses

Browse pgsql-pkg-debian by date

  From Date Subject
Next Message Christoph Berg 2026-01-14 19:39:35 Re: pg_upgradecluster and synchronous replication
Previous Message apt.postgresql.org Repository Update 2026-01-14 17:15:17 barman updated to version 3.17.0-1.pgdg+1