Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1osof9-0003ez-1B for pgsql-admin@arkaria.postgresql.org; Wed, 09 Nov 2022 17:14:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1osoe9-0000kH-PS for pgsql-admin@arkaria.postgresql.org; Wed, 09 Nov 2022 17:13:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1osoe9-0000k7-Cq for pgsql-admin@lists.postgresql.org; Wed, 09 Nov 2022 17:13:53 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1osoe3-00071w-2O for pgsql-admin@lists.postgresql.org; Wed, 09 Nov 2022 17:13:52 +0000 Received: by mail-wr1-x435.google.com with SMTP id j15so26767539wrq.3 for ; Wed, 09 Nov 2022 09:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=0oriRzqJrxl/S/3vZCCxvT8OMOiB7MG2gJV7F4Gr0Jo=; b=NesvVmeXzUHfGUnATa47yg3n1jLfpfKfURc6OW9elEVQmY+sRvmU20KEPxdPrTmkG+ 7IXGYN6q/wn8MRKJTBqYLG2bKXOCnfF1LvCMBpoFOlvltY/rWPz2RzUgs79GUNdubAJj nkGochlLftnfzCg+SQINpXVRjb/F8QzQR6DGIHtO5MncJmkekW5qNOnXxpfeoRuil44k +I4FH2YQEiHxJwixpZQA2j5bQN+t/YEZjP51jiuYlIjUfradN9E34zotvx1a5w0cFHAA oJhruAU6ATzbZ+UDAXQ6K9lI4oxITxCLLKvvFLAvC1DxLkLrbqMtMAmJbfvFBhHGqrzd oeWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0oriRzqJrxl/S/3vZCCxvT8OMOiB7MG2gJV7F4Gr0Jo=; b=auHVduB/0Q5TBAUsoVI/awhTxMC1yHQPB2f58qABDN8zDb2PqYmB3MH48Lr6jzkMhn xRzEKBJ0r7Rv2RRUnJdQ0lA3MV5fKeKLZb2PgUj6cCgCzGEP8zVi5TOMrrCSUmojUyi+ i71JYgm1BSMwdcveJxHMIuTKpR5KhzJxni2yTRrs9hEhRvYFgbD8+haWLEG1xrEcIJcG GPnpeic2fCMXAIECtI1o5G77FePRWly3i6u7HBpo5LB5J4O0Z81PNTiy/mNUeJvjFkfi LQNFo1dVPRq6TgWzP3tZ1FyKKfHGYSDdfFZr26Jkpp/JkKSh2rAByyidyJI+4FpbDVE/ oOsw== X-Gm-Message-State: ACrzQf3t7Z+WcwYsKtusEh9Wfqvja27foSW5s2ubPQ1vxcDA79DUpqpO RprdjxhflsiUFNAProZZbI8= X-Google-Smtp-Source: AMsMyM6vPqw+2Zm7uRrxi+rmlYA4xZc9Nx5B6MfB2sDY+UfdxuSxqPYagDnCm/BExh1yKGJtBcpzeA== X-Received: by 2002:adf:e704:0:b0:23a:1e9a:c554 with SMTP id c4-20020adfe704000000b0023a1e9ac554mr19575517wrm.167.1668014024992; Wed, 09 Nov 2022 09:13:44 -0800 (PST) Received: from z600.home.lan ([195.213.130.125]) by smtp.gmail.com with ESMTPSA id e8-20020a5d5948000000b0023657e1b97esm13820631wri.11.2022.11.09.09.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 09:13:44 -0800 (PST) Date: Wed, 9 Nov 2022 17:13:42 +0000 From: Sad Clouds To: "David G. Johnston" Cc: pgsql-admin@lists.postgresql.org Subject: Re: pg_upgrade questions Message-Id: <20221109171342.2d5f1d365efa709c5200d090@gmail.com> In-Reply-To: References: <20221109142510.2b528bd331c5d9482c59291d@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 9 Nov 2022 09:21:57 -0700 "David G. Johnston" wrote: > I cannot tell if you are talking about physical or logical > replication...but only the former matters for this purpose. I don't know > why you'd want to disable replication, what you need to do is ensure that > there is zero activity on the primary and that the standby has caught up > applying all WAL that has already been generated (and no WAL is pending). > Hence the requirement to check pg_controldata. > > Step 11 covers your options. I don't suggest you invent your own. > > rsync is the means by which you avoid "large data transfers". > > David J. Hi David, thanks for your reply. Yes I was referring to physical replication. Step 11 in the pg_upgrade guide implies that the primary server has to be upgraded first, then rsync copies upgraded files and links to the standby server. For various reasons, it would be desirable for me to upgrade the standby server first, while the primary database is fully up and running. I don't have much control over the applications using the primary data base and cannot make them wait unspecified amount of time until no WAL is pending on the standby. The outage during database upgrade needs to be absolutely minimal, hence the use of --link option. I'm not an expert on PostgreSQL replication, so was hoping there was a way to upgrade standby, while primary is modifying data, then later upgrade primary and tell it to synchronize any new data to standby. Maybe there is a way to pause replication and leave both servers in a consistent state? Can any outstanding WAL on primary be automatically replayed to standby? But, if I understand you correctly, then this is not going to work at all. I may need to discard all data on the standby and restart replication from empty.