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.94.2) (envelope-from ) id 1tkmOn-006k3g-Pj for pgsql-admin@arkaria.postgresql.org; Wed, 19 Feb 2025 15:54:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tkmOm-00AJuF-9h for pgsql-admin@arkaria.postgresql.org; Wed, 19 Feb 2025 15:54:08 +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.94.2) (envelope-from ) id 1tkmOl-00AJtE-SD for pgsql-admin@lists.postgresql.org; Wed, 19 Feb 2025 15:54:08 +0000 Received: from fhigh-b7-smtp.messagingengine.com ([202.12.124.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tkmOk-001jjw-1O for pgsql-admin@lists.postgresql.org; Wed, 19 Feb 2025 15:54:07 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9FF2025401FE; Wed, 19 Feb 2025 10:54:05 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 19 Feb 2025 10:54:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1739980445; x=1740066845; bh=B F2LpimEKof5JALl1Z+Yj2sEyEJRyac6/T+aRJpJLWU=; b=i3IHck3nzoFxN2K3J Hu1kH505r3/XU8QKS15eAPa80soRb3p8o+1FJmYrQ8rHwidvzzy3ql+DXjaZ95d3 HMDS8BZU5anGBr4EqBCVWSNrLKy+iexXVn+XavLN6g98qPI42iaNCik0v6b/Qsx3 xZhg5e0p+K+tq2CU1tenJCdS2pHOoS2mmMV4Yk9pzmhQDkHVLqwfmAYpwxIwSRDJ 871a+cMx4VPYDvvJLqU6WodlmLxk/3Qws8F84aUkbPc8Yw5IaNQlRjEp7SSiYr1a Kv47Gc2OSkkiailQr7u25YuL/4lBUZHyY+XQx2j/JQIvtnIyYLBGqIr81ObdQzZB 5E3Lg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeigeeiiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvf evuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhhoucfjvghrrhgv rhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrth htvghrnhepvdehueffhefgueekueefheehgffhuefgfedukeejveduffegffekgeffffev geehnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghl vhhhrdhnohdqihhprdhorhhgpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehrihgthhgrrhgusehkohhjvgguiidrihhnpdhrtghpthhtohep phhgshhqlhdqrggumhhinheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Feb 2025 10:54:04 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1739980443; bh=n9nX2/Zf2h/LIAvpMTmrdEv80Z67GFNpX6sfs/6vuO8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=eMrxWUKTAnyIIqh21z3y3KLTmd/LhUKRjrkrZE6LCvsnOl0tgeAqH+ILbVoyuv+Hr woQLtRxeWegCaNnmq7X04zu3epgtJZVziBSMd9YRa37MwheaPuJL2PiyXqupc9Y7Ui MBlPiWQowjtAysk49V1xst24/4zme6kFTpeOedcsgWrRa3TXHZUmNFQPcsSSAPTC9K QLQq2xys1IbdXuavRA7issIAsKkhk+RlDZr5y3uBN2ezmUwle+XiiyBcs6y/y9HOu3 ib+aE+lJJuGK61G1R+HgDAKPBhhGXK1y1tPgNS9MENOjjh7Uc7juUoR4ySihgT91Z4 sX+0iYccuSA7Q== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 3B7438F; Wed, 19 Feb 2025 16:54:03 +0100 (CET) Date: Wed, 19 Feb 2025 16:54:03 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: richard@kojedz.in Cc: pgsql-admin@lists.postgresql.org Subject: Re: In-place upgrade with streaming replicas Message-ID: <202502191554.6asefyczl7jn@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Feb-19, richard@kojedz.in wrote: > With this, I have the question, that after the shutdown of primary, what is > the guarantee for replicas having the same checkpoint location? Why does the > order of shutting down the servers matter? What would be the really exact > and reliable way to ensure that replicas will have the same checkpoint > location as the primary? The replicas can't write WAL by themselves, but they will replay whatever the primary has sent; by shutting down the primary first and letting the replicas catch up, you ensure that the replicas will actually receive the shutdown record and replay it. If you shut down the replicas first, they can obviously never catch up with the shutdown checkpoint of the primary. As I recall, if you do shut down the primary first, one potential danger is that the primary fails to send the checkpoint record before shutting down, so the replicas won't receive it and obviously will not replay it; or simply that they are behind enough that they receive it but don't replay it. You could use pg_controldata to read the last checkpoint info from all nodes. You can run it on the primary after shutting it down, and then on each replica while it's still running to ensure that the correct restartpoint has been created. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Someone said that it is at least an order of magnitude more work to do production software than a prototype. I think he is wrong by at least an order of magnitude." (Brian Kernighan)