pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Reuse an existing slot with a new initdb
11+ messages / 6 participants
[nested] [flat]

* Reuse an existing slot with a new initdb
@ 2020-05-08 20:51  Support <admin@e-blokos.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Support @ 2020-05-08 20:51 UTC (permalink / raw)
  To: pgsql-general

I normalized my replislots with the name of my nodes.
I have 2 options in my recovery script that tries first pg_basebackup
to recover and sync the hot standby, but unfortunately big DB fails 
sometimes due
to very slow or unstable network. So my second option is to completely 
make a new inidb and import an sql file from pg_dumpall master as it 
takes less bytes once compressed. But I'm facing an issue with the slot 
complaining (obviously) about the ho standby node that does not match 
the slot identifier. So my question is simple, is there a way to 
reinitialize the slot to not renew the identifier with the new hot 
standby initdb?

Thanks

David





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-13 13:18  Support <admin@e-blokos.com>
  parent: Support <admin@e-blokos.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Support @ 2020-05-13 13:18 UTC (permalink / raw)
  To: pgsql-general


On 5/8/2020 1:51 PM, Support wrote:
> I normalized my replislots with the name of my nodes.
> I have 2 options in my recovery script that tries first pg_basebackup
> to recover and sync the hot standby, but unfortunately big DB fails 
> sometimes due
> to very slow or unstable network. So my second option is to completely 
> make a new inidb and import an sql file from pg_dumpall master as it 
> takes less bytes once compressed. But I'm facing an issue with the 
> slot complaining (obviously) about the ho standby node that does not 
> match the slot identifier. So my question is simple, is there a way to 
> reinitialize the slot to not renew the identifier with the new hot 
> standby initdb?
>
> Thanks
>
> David

No one has an answer to my question?
thanks!

David





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-13 20:24  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Support <admin@e-blokos.com>
  0 siblings, 3 replies; 11+ messages in thread

From: Laurenz Albe @ 2020-05-13 20:24 UTC (permalink / raw)
  To: Support <admin@e-blokos.com>; pgsql-general

On Wed, 2020-05-13 at 06:18 -0700, Support wrote:
> On 5/8/2020 1:51 PM, Support wrote:
> > I normalized my replislots with the name of my nodes.
> > I have 2 options in my recovery script that tries first pg_basebackup
> > to recover and sync the hot standby, but unfortunately big DB fails 
> > sometimes due
> > to very slow or unstable network. So my second option is to completely 
> > make a new inidb and import an sql file from pg_dumpall master as it 
> > takes less bytes once compressed. But I'm facing an issue with the 
> > slot complaining (obviously) about the ho standby node that does not 
> > match the slot identifier. So my question is simple, is there a way to 
> > reinitialize the slot to not renew the identifier with the new hot 
> > standby initdb?
> 
> No one has an answer to my question?

That may be because your question is hard to understand.

You cannot create a standby server using "pg_dumpall", so it is
unclear what exactly you are doing here.

Also, it is not clear what error message you get.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-13 21:12  live-school support <infos@live-school.net>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  2 siblings, 1 reply; 11+ messages in thread

From: live-school support @ 2020-05-13 21:12 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


Best Regards

LIVE-SCHOOL FOUNDATION
http://www.live-school.net
infos@live-school.net
On 5/13/2020 1:24 PM, Laurenz Albe wrote:
> On Wed, 2020-05-13 at 06:18 -0700, Support wrote:
>> On 5/8/2020 1:51 PM, Support wrote:
>>> I normalized my replislots with the name of my nodes.
>>> I have 2 options in my recovery script that tries first pg_basebackup
>>> to recover and sync the hot standby, but unfortunately big DB fails
>>> sometimes due
>>> to very slow or unstable network. So my second option is to completely
>>> make a new inidb and import an sql file from pg_dumpall master as it
>>> takes less bytes once compressed. But I'm facing an issue with the
>>> slot complaining (obviously) about the ho standby node that does not
>>> match the slot identifier. So my question is simple, is there a way to
>>> reinitialize the slot to not renew the identifier with the new hot
>>> standby initdb?
>> No one has an answer to my question?
> That may be because your question is hard to understand.
>
> You cannot create a standby server using "pg_dumpall", so it is
> unclear what exactly you are doing here.
>
> Also, it is not clear what error message you get.
>
> Yours,
> Laurenz Albe
Thanks Laurenz,

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?





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-13 21:19  Support <admin@e-blokos.com>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  2 siblings, 0 replies; 11+ messages in thread

From: Support @ 2020-05-13 21:19 UTC (permalink / raw)
  To: pgsql-general



On 5/13/2020 1:24 PM, Laurenz Albe wrote:
> On Wed, 2020-05-13 at 06:18 -0700, Support wrote:
>> On 5/8/2020 1:51 PM, Support wrote:
>>> I normalized my replislots with the name of my nodes.
>>> I have 2 options in my recovery script that tries first pg_basebackup
>>> to recover and sync the hot standby, but unfortunately big DB fails
>>> sometimes due
>>> to very slow or unstable network. So my second option is to completely
>>> make a new inidb and import an sql file from pg_dumpall master as it
>>> takes less bytes once compressed. But I'm facing an issue with the
>>> slot complaining (obviously) about the ho standby node that does not
>>> match the slot identifier. So my question is simple, is there a way to
>>> reinitialize the slot to not renew the identifier with the new hot
>>> standby initdb?
>> No one has an answer to my question?
> That may be because your question is hard to understand.
>
> You cannot create a standby server using "pg_dumpall", so it is
> unclear what exactly you are doing here.
>
> Also, it is not clear what error message you get.
>
> Yours,
> Laurenz Albe
 > it is not clear what error message you get.
Each has apparently an internal identifier  based on the hot standby 
initdb when it connected to the master the first time(?) or when a 
pg_basebackup occured previously
this identifier (unique bigint) obviously does not match if I connect 
the hot standby with a new initdb and a restore from pg_dumpall copy of 
the master.
Sad because everything seems to be running but the master just does not 
like the identifier doesn't match up. (sorry I cannot show you the 
original error since I run the db in prod now)






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-13 21:24  Support <admin@e-blokos.com>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  2 siblings, 0 replies; 11+ messages in thread

From: Support @ 2020-05-13 21:24 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


On 5/13/2020 1:24 PM, Laurenz Albe wrote:
> On Wed, 2020-05-13 at 06:18 -0700, Support wrote:
>> On 5/8/2020 1:51 PM, Support wrote:
>>> I normalized my replislots with the name of my nodes.
>>> I have 2 options in my recovery script that tries first pg_basebackup
>>> to recover and sync the hot standby, but unfortunately big DB fails
>>> sometimes due
>>> to very slow or unstable network. So my second option is to completely
>>> make a new inidb and import an sql file from pg_dumpall master as it
>>> takes less bytes once compressed. But I'm facing an issue with the
>>> slot complaining (obviously) about the ho standby node that does not
>>> match the slot identifier. So my question is simple, is there a way to
>>> reinitialize the slot to not renew the identifier with the new hot
>>> standby initdb?
>> No one has an answer to my question?
> That may be because your question is hard to understand.
>
> You cannot create a standby server using "pg_dumpall", so it is
> unclear what exactly you are doing here.
>
> Also, it is not clear what error message you get.
>
> Yours,
> Laurenz Albe
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?

Each has apparently an internal identifier  based on the hot standby 
initdb when it connected to the master the first time(?) or when a 
pg_basebackup occured previously
this identifier (unique bigint) obviously does not match if I connect 
the hot standby with a new initdb and a restore from pg_dumpall copy of 
the master.
Sad because everything seems to be running but the master just does not 
like the identifier doesn't match up. (sorry I cannot show you the 
original error since I run the db in prod now)





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-14 03:52  Michael Paquier <michael@paquier.xyz>
  parent: live-school support <infos@live-school.net>
  0 siblings, 1 reply; 11+ messages in thread

From: Michael Paquier @ 2020-05-14 03:52 UTC (permalink / raw)
  To: live-school support <infos@live-school.net>; +Cc: pgsql-general@lists.postgresql.org

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?).

Like Laurenz, I am not sure what is your problem, what are the errors
PostgreSQL are producing and what you expect from Postgres.  If you
could describe clearly step-by-step what you are doing and what you
expect the result would be based on your configuration, we may be able
to help, but it is not really possible to help out without more
details.  For example, the first sentence of your first email mentions
the use of replication slots.  You may want to explain better where
the slots are used, how they get either dropped and/or recreated, etc.
-
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Reuse an existing slot with a new initdb
@ 2020-05-14 04:28  David G. Johnston <david.g.johnston@gmail.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 11+ messages in thread

From: David G. Johnston @ 2020-05-14 04:28 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: live-school support <infos@live-school.net>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

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.

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-14 10:29  Support <admin@e-blokos.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Support @ 2020-05-14 10:29 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>


On 5/13/2020 9:28 PM, David G. Johnston wrote:
> On Wednesday, May 13, 2020, Michael Paquier <michael@paquier.xyz 
> <mailto: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

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-14 13:33  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Support <admin@e-blokos.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Tom Lane @ 2020-05-14 13:33 UTC (permalink / raw)
  To: Support <admin@e-blokos.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Support <admin@e-blokos.com> writes:
> I think David caught it, the question is Why, as long as we have an 
> exact copy of the master (from pg_dumpall)

Stop right there.  pg_dumpall does *not* produce an exact copy.
It produces a logically equivalent copy, which is not close enough
for physical replication to work.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Reuse an existing slot with a new initdb
@ 2020-05-14 13:41  Support <admin@e-blokos.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 11+ messages in thread

From: Support @ 2020-05-14 13:41 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


On 5/14/2020 6:33 AM, Tom Lane wrote:
> Support <admin@e-blokos.com> writes:
>> I think David caught it, the question is Why, as long as we have an
>> exact copy of the master (from pg_dumpall)
> Stop right there.  pg_dumpall does *not* produce an exact copy.
> It produces a logically equivalent copy, which is not close enough
> for physical replication to work.
>
> 			regards, tom lane
>
>
Ah ok, so there is no way to make physical <--> logical copy jumping 
so... :(





^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2020-05-14 13:41 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 20:51 Reuse an existing slot with a new initdb Support <admin@e-blokos.com>
2020-05-13 13:18 ` Support <admin@e-blokos.com>
2020-05-13 20:24   ` Laurenz Albe <laurenz.albe@cybertec.at>
2020-05-13 21:12     ` live-school support <infos@live-school.net>
2020-05-14 03:52       ` Michael Paquier <michael@paquier.xyz>
2020-05-14 04:28         ` David G. Johnston <david.g.johnston@gmail.com>
2020-05-14 10:29           ` Support <admin@e-blokos.com>
2020-05-14 13:33             ` Tom Lane <tgl@sss.pgh.pa.us>
2020-05-14 13:41               ` Support <admin@e-blokos.com>
2020-05-13 21:19     ` Support <admin@e-blokos.com>
2020-05-13 21:24     ` Support <admin@e-blokos.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox