Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vg6x7-008Mrs-0u for pgsql-pkg-debian@arkaria.postgresql.org; Wed, 14 Jan 2026 19:54:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vg6x5-00CQ24-0z for pgsql-pkg-debian@arkaria.postgresql.org; Wed, 14 Jan 2026 19:54:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vg6x4-00CQ1w-33 for pgsql-pkg-debian@lists.postgresql.org; Wed, 14 Jan 2026 19:54:47 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vg6x2-000RG7-2X for pgsql-pkg-debian@lists.postgresql.org; Wed, 14 Jan 2026 19:54:46 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-47d3ffa5f33so1110495e9.2 for ; Wed, 14 Jan 2026 11:54:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1768420484; x=1769025284; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=ukR9479p8SywzCZe473OeXRE5DtHCZhCF64G4Qgms/g=; b=bb+yC3y3twTTcNAuQ6wzhrY/bVHvlhYavG7ViPS9Y4ckBj+dge8vdhGfrK3A/e/s3x cREairr4KKIjH6avpGHHS/+l6aqW654nb+NoFP5baDwYeI50MyriUYX7hrhrc/TSjfX9 K6XAR2niXyD6jbXLf4zjDfjJ0yA5QTodLH2dQL4U8ciptJs5jjWPmzCnj1u8xTfEro+b kwFb1hd2kXKfhBRClY6oe+0zDyaj398vRwd9JGXVxlRiI/6shESD+GSGSsypHODTmltZ ZfN0zYHvq346ZbT4rm44mxV93E9qJHFF5AMwqttXNSBqQJjVUEdX39x8jIfVS3KsyCt5 xiHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768420484; x=1769025284; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ukR9479p8SywzCZe473OeXRE5DtHCZhCF64G4Qgms/g=; b=rX1yiqeBPjkItqSIMiJ/uL3YN72bJdShchtymghikXEnmymm7UMfgM3Y5DffxLuPxp YMFnuhhe3u6XguFT6b6Ob5RwpV1SKGuBT0FNquj9vXkLQ8YOMU/C2tqiHNZFd3a1y+Jw /qiZz230Xub7ohdVJUBfxRGRJMqwbX1DJAGGIbNo2boAkfw+gHCmMe1sOlwIuJNHApkW MZEwWabFbUsRI2PdLR57ZYXAibzo6WYc5AAW6/RXaUyQrOSLse78afAmsJfvW1sGcvRz VRCwY5wcV6w+xLVTUxaU4fd/1fV7XZ7TSu+7ZLAhi+rB2EafUKaU/wqfdz1ncqy1X7tu EjgQ== X-Gm-Message-State: AOJu0YyZKeOAL25KqH2y4ovCtccjYeSh04W9b4md9W8BCWXSyRd+Dipc oZPOnpV1gaSL4oIKpYBcYQvGHNjNfeNPRB4Y8Cr1pwIVq3EhMQU1h5VeL8wRmRbP6JE= X-Gm-Gg: AY/fxX6SyG2T8tHgL9qmVf92HbeEOp2qKWU1PLzJIQK9BoKK8mr+HFguXXjg9xdNFdr CWpeH0EeP3CNWY/teg8n1pehK+0RlAJI3oAxvcAcAMb9PIumUFEINm6rkT0VgKVFChyBWqeEC1j zbSwjsjvT8EY6mAZIMCyiSGaEuwaHXibdubrt+6pqi8qAe8UHj+Vs5BLbAZdZ6Se/5j+yVUNNza iwNiDHe1TfK4TstggmGmeInc+5tg9ZPXfIKPi1mONaSDp5dPLduTl1JNIA93q0Dt3tHmfHC1Dah bYPLmVMmWr18aFCAe1mAKtN+KXzFh4e99FN7qKdwqIGk/dmY7muawPQ3sq9FF6xur7VqAwpbPga CLF0inKiKoM68HsOAzV0pDJwj1GcBB5nGXV2l7UCQUMam7A1MYoD5WBwaZizgficeIM1Hjq6Pmj RoYXF2poENjjfFBTH3EAbAveJWfkUUV4mnCWrPiAjJ5dZGngtNSXA= X-Received: by 2002:a05:600c:8705:b0:456:1a69:94fa with SMTP id 5b1f17b1804b1-47ee3345cc1mr39274105e9.13.1768420484069; Wed, 14 Jan 2026 11:54:44 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([46.151.204.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-434af6e1698sm1199876f8f.37.2026.01.14.11.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 11:54:43 -0800 (PST) Message-ID: Subject: Re: pg_upgradecluster and synchronous replication From: Laurenz Albe To: Christoph Berg Cc: pgsql-pkg-debian@lists.postgresql.org Date: Wed, 14 Jan 2026 20:54:43 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2026-01-14 at 20:39 +0100, Christoph Berg wrote: > > =C2=A0=C2=A0 vacuumdb ... --analyze-in-stages --missing-stats-only > >=20 > > processing hung, because the synchronous standby was not available and = the transaction > > could not commit. > > > > I wonder if pg_upgradecluster could improve things by disabling synchro= nous_standby_names > > when the cluster ist started for the "finish" stage.=C2=A0 I have attac= hed a POC patch how this > > could be done.=C2=A0 I didn't test it, and my Perl skills are marginal,= but you get the idea. >=20 > Maybe we should instead change the analyze hook script to do that > internally? Setting PGOPTIONS should be enough: >=20 > =C2=A0=C2=A0=C2=A0 PGOPTIONS=3D"-csynchronous_commit=3Dlocal" >=20 > > Perhaps this is too much black magic, not sure.=C2=A0 But I wanted to s= hare my experience. >=20 > There is already some code in pg_upgradecluster that works around > black magic problems: >=20 > =C2=A0=C2=A0=C2=A0 # ensure we can upgrade DBs with default read-only tra= nsactions > =C2=A0=C2=A0=C2=A0 $ENV{PGOPTIONS} .=3D " -cdefault_transaction_read_only= =3Doff"; >=20 > This would just add one more wart of that kind. That looks like a better way to do it, I agree. > That's also the command that does the final cluster start for > production, I wouldn't want such a change to persist. That makes me wonder. I don't think that it is a great idea to start the c= luster for production with "synchronous_commit" set to a non-standard value. That wou= ld mask the problem initially, but whenever the cluster is restarted, the parameter is = back to its original value, and suddenly things will stop working. I can imagine two ways to do better: 1. Set "synchronous_commit=3Dlocal" during the ANALYZE, then restart the cl= uster without overriding any parameters. Then the upgrade itself would work, and the = problem with the missing synchronous standby would manifest right when the user start= s using the upgraded cluster. Better than having things start failing after the nex= t restart, perhaps months later, when it is harder to trace the problem to its orig= inal cause! 2. Add a pre-upgrade check that just aborts with a useful error message if "synchronous_standby_names" is set. Yours, Laurenz Albe