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 1jZB7J-0000Vg-AZ for pgsql-general@arkaria.postgresql.org; Thu, 14 May 2020 10:29:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jZB7H-0007ri-QI for pgsql-general@arkaria.postgresql.org; Thu, 14 May 2020 10:29:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZB7H-0007mm-Hm for pgsql-general@lists.postgresql.org; Thu, 14 May 2020 10:29:27 +0000 Received: from ns76.e-blokos.com ([51.79.78.76] helo=node76.e-blokos.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZB7A-00071f-3n for pgsql-general@lists.postgresql.org; Thu, 14 May 2020 10:29:26 +0000 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by node76.e-blokos.com (8.15.2/8.15.2) with ESMTP id 04EATG3w061313 for ; Thu, 14 May 2020 10:29:18 GMT Subject: Re: Reuse an existing slot with a new initdb To: "pgsql-general@lists.postgresql.org" References: <5f198805-8fd4-b49b-4046-e98fb80dea74@e-blokos.com> <48699aec-7736-6b8a-cd92-fe6d93db6a78@e-blokos.com> <48434f500ee2bf9572e6bbff143be073114f8c42.camel@cybertec.at> <779da3eb-6762-dbb8-3019-8c8515bf7397@live-school.net> <20200514035234.GC166343@paquier.xyz> From: Support Message-ID: <5779b92e-5773-92a4-0e73-9df3e5e90fc6@e-blokos.com> Date: Thu, 14 May 2020 03:29:15 -0700 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------E3F025E523BCA1E3B7EA5CB8" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E3F025E523BCA1E3B7EA5CB8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 5/13/2020 9:28 PM, David G. Johnston wrote: > On Wednesday, May 13, 2020, Michael Paquier > wrote: > > On Wed, May 13, 2020 at 02:12:45PM -0700, live-school support wrote: > > I didn't recal that it was not possible to create a hot standby > with a fresh > > new install and pg_dumpall :(. > > > > only pg_basebackup or an exact copy of the data folder can do it > right? is > > the reason technical or else? > > When using physical replication, both the primary and standby need to > have the same system ID, and both instances need to share the same > architectures to work properly as data is physically replayed from one > cluster to the other using WAL, which includes for example copies of > on disk relation 8kB pages (ever heard of full_page_writes?). > > > This basically hits the nail on the head.  My reading is that the OP > has two abstractly identical restored databases, one created from a > physical copy and the other from a logical copy. The issue is why the > original server cannot use the same replication slot name to continue > synchronizing with the logically restored one but is able to continue > with the physically restored one.  The above is why. > > The OP asks whether the technical identifier error encountered can be > overcome.  It cannot but even if it could the attempt would still end > up failed due to fundamental differences in the physical data layouts > between physical and logical restoration.  If the OP needs to rebuild > a physical replication hot standby database they must use a physical > backup of the original database as a starting point.  To use a > logically restored database target would require logical replication. > > David J. > Thanks Michael and David for your answers I think David caught it, the question is Why, as long as we have an exact copy of the master (from pg_dumpall) we cannot start a new initdb hot standby with an already existing physical replication slots without the master complain about this "identifier doesn't match up" knowing that everything seems to be synchronized? Sorry Michael to not show you more logs, I made these tests weeks ago and cannot restart them for now, too busy on other jobs. David --------------E3F025E523BCA1E3B7EA5CB8 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit


On 5/13/2020 9:28 PM, David G. Johnston wrote:
On Wednesday, May 13, 2020, Michael Paquier <michael@paquier.xyz> wrote:
On Wed, May 13, 2020 at 02:12:45PM -0700, live-school support wrote:
> I didn't recal that it was not possible to create a hot standby with a fresh
> new install and pg_dumpall :(.
>
> only pg_basebackup or an exact copy of the data folder can do it right? is
> the reason technical or else?

When using physical replication, both the primary and standby need to
have the same system ID, and both instances need to share the same
architectures to work properly as data is physically replayed from one
cluster to the other using WAL, which includes for example copies of
on disk relation 8kB pages (ever heard of full_page_writes?).

This basically hits the nail on the head.  My reading is that the OP has two abstractly identical restored databases, one created from a physical copy and the other from a logical copy.  The issue is why the original server cannot use the same replication slot name to continue synchronizing with the logically restored one but is able to continue with the physically restored one.  The above is why.

The OP asks whether the technical identifier error encountered can be overcome.  It cannot but even if it could the attempt would still end up failed due to fundamental differences in the physical data layouts between physical and logical restoration.  If the OP needs to rebuild a physical replication hot standby database they must use a physical backup of the original database as a starting point.  To use a logically restored database target would require logical replication.

David J.

Thanks Michael and David for your answers
I think David caught it, the question is Why, as long as we have an exact copy of the master (from pg_dumpall) we cannot start a new initdb hot standby with an already existing physical replication slots without the master complain about this "identifier doesn't match up"
knowing that everything seems to be synchronized?
Sorry Michael to not show you more logs, I made these tests weeks ago and cannot restart them for now, too busy on other jobs.

David
--------------E3F025E523BCA1E3B7EA5CB8--