public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Christoph Berg <[email protected]>
Cc: [email protected]
Subject: Re: pg_upgradecluster and synchronous replication
Date: Thu, 15 Jan 2026 23:41:40 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
On Thu, 2026-01-15 at 05:40 +0100, I wrote:
> > On Wed, 2026-01-14 at 20:39 +0100, Christoph Berg wrote:
> > >
> > > Maybe we should instead change the analyze hook script to do that
> > > internally? Setting PGOPTIONS should be enough:
> > >
> > > PGOPTIONS="-csynchronous_commit=local"
>
> Yes, I think that is the proper solution!
How about the attached patch?
Yours,
Laurenz Albe
Attachments:
[text/x-patch] v2-0001-Prevent-ANALYZE-from-waiting-for-synchronous-stan.patch (1.1K, 2-v2-0001-Prevent-ANALYZE-from-waiting-for-synchronous-stan.patch)
download | inline diff:
From 8ee74b3f17ab3b9a4f18d585769ba8da05c96fc5 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <[email protected]>
Date: Thu, 15 Jan 2026 23:37:00 +0100
Subject: [PATCH v2] Prevent ANALYZE from waiting for synchronous standbys
If the cluster to upgrade has synchronous replication configured,
"vacuumdb --analyze-only" will hang waiting for the feedback of a
synchronous standby, but there is none during an upgrade.
To prevent that, set "synchronous_commit" to "local" while optimizer
statistics are being calculated.
https://postgr.es/m/flat/[email protected]
---
pg_upgradecluster.d/analyze | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pg_upgradecluster.d/analyze b/pg_upgradecluster.d/analyze
index 6480b5e..2a8d145 100755
--- a/pg_upgradecluster.d/analyze
+++ b/pg_upgradecluster.d/analyze
@@ -19,6 +19,9 @@ case $newversion in
;;
esac
+# don't hang waiting for a synchronous standby server
+export PGOPTIONS="$PGOPTIONS -csynchronous_commit=local"
+
case $newversion in
9.2|9.3)
vacuumdb $flags --analyze-only
--
2.52.0
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: pg_upgradecluster and synchronous replication
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox