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 1jlCvS-0000Bt-1K for pgsql-admin@arkaria.postgresql.org; Tue, 16 Jun 2020 14:50:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlCvQ-0007wS-Bf for pgsql-admin@arkaria.postgresql.org; Tue, 16 Jun 2020 14:50:56 +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 1jlCvP-0007wL-Tb for pgsql-admin@lists.postgresql.org; Tue, 16 Jun 2020 14:50:56 +0000 Received: from admin.sibptus.ru ([2001:19f0:5001:21dc::10]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlCvM-0006zw-Ke for pgsql-admin@lists.postgresql.org; Tue, 16 Jun 2020 14:50:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=wgXyX7iNyAB86iqF8VgvwnGqpuWcV/xzdnOCI6opaJ8=; b=cM+YYUwA+RhkcIEVMtZTheyliK 7soRVHnrAdJC0E4ClGF9JHo/7U13FSNhQ31iPVHgzf1qpJ0/9FM2D3SiuN08QZYfO6FzFKXm5bkf7 sJPSd+VpTAEOv5t5ZtkWMzZ+0qIntSufLnVfwVeGcZEBMGoqDFqnRtpFwYt0f86a1FsU=; Received: from vas by admin.sibptus.ru with local (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jlCvJ-000H7h-TX for pgsql-admin@lists.postgresql.org; Tue, 16 Jun 2020 21:50:49 +0700 Date: Tue, 16 Jun 2020 21:50:49 +0700 From: Victor Sudakov To: pgsql-admin@lists.postgresql.org Subject: Re: Upgrade streaming replication and log-shipping standby servers Message-ID: <20200616145049.GB62975@admin.sibptus.ru> References: <20200615104619.GA97072@admin.sibptus.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: http://admin.sibptus.ru/~vas/ X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Greg Spiegelberg wrote: > > > > > When upgrading to a new major version, pg_upgrade documentation > > > > https://www.postgresql.org/docs/current/pgupgrade.html#PGUPGRADE-STEP-REPLICAS > > states that pg_upgrade can be used on a master server. After upgrading > > the PostgreSQL version on standbys, however, one must either pull the > > data from scratch with pg_basebackup, or run rsync from master to > > standby. > > > > Is running pg_upgrade on replicas not supported and why? > > > > > Hi Victor, > > I agree it would be extraordinarily convenient if pg_upgrade could operate > on standbys. > > Via experience and a quick code read of pg_upgrade source confirms that the > new, initialized and as yet unmodified cluster is modified in preparation > for an upgrade. Some of those new cluster modifications include execution > of analyze, freezing rows, resetting WAL, modification of > controldata(?) and restoration of the old schema. These and others are > evident running the utility in verbose mode. Setting aside a standby must > be promoted for these modifications, there is no current way to > guarantee these modifications will be consistently done on both primary and > all standbys. A standby inconsistent with the primary is no standby at all. Hi Greg, Thank you for the detailed explanation. > > Perhaps not the right place but I would argue that IF pg_upgrade could > 1) pause after all these new cluster modifications at or soon after > "Restoring database schemas in the new cluster", > 2) permit standbys to replicate the new cluster, > 3) continue on primary, and > 4) run on standbys picking up from where it left off at step 2 perhaps in > coordination with primary > then it would be very nice but I'm making assumptions and painting with a > wide brush. :) > Sounds very tricky. -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/