Re: pg_upgrade + replica servers + rsync --size-only is unsafe

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Rob Emery <re-pgsql(at)codeweavers(dot)net>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_upgrade + replica servers + rsync --size-only is unsafe
Date: 2020-12-03 13:10:53
Message-ID: CAOuzzgqd=zsOvaiCu_agYES-BCZANAQYLghh7MfJQ7yNF8Xu2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Greetings,

Please don’t top post on these lists. Thanks.

On Thu, Dec 3, 2020 at 06:42 Rob Emery <re-pgsql(at)codeweavers(dot)net> wrote:

> Hello Stephen,
>
> >Then you run the rsync, at the /srv level, and all those 'new files' in
> >/srv/new_cluster on the primary should get copied over to
> >/srv/new_cluster on the replica, while any files which are hard-linked
> >between old_cluster and new_cluster should end up as hard links on the
> >replica.
> >
> >Thanks,
>
> Thanks very much for your reply.
>
> We've re-ran our test upgrade this morning just to be certain and we
> reproduced the same result once again, it appears that the issue is not
> that the pg_controlfile is hardlinked, but that it exists at all.
>
> The output of pg_controldata shows a different ID on the master and the
> secondary as you suspected:
>
> Master:
>
> $ ./pg_controldata /var/lib/postgresql/9.6/main
> pg_control version number: 960
> Catalog version number: 201608131
> Database system identifier: 6901965895850147745
> Database cluster state: in production
> pg_control last modified: Thu 03 Dec 2020 10:11:21 GMT
>
> Secondary:
>
> $ ./pg_controldata /var/lib/postgresql/9.6/main
> pg_control version number: 960
> Catalog version number: 201608131
> Database system identifier: 6901966223447496344
> Database cluster state: shut down
> pg_control last modified: Thu 03 Dec 2020 09:54:00 GMT
>
> The pg_control file does exist on the secondary 9.6 prior to the rsync
> because it is created by the initdb command (which is step 4. of the
> instructions - https://www.postgresql.org/docs/9.6/pgupgrade.html; we
> verified that by running `/usr/lib/postgresql/9.6/bin/initdb
> /var/lib/postgresql/999/main` and it creates a pg_control file).
>

The initdb is run only on the primary. Note that 10.b specifically says:

1.

Make sure the new standby data directories do not exist

Make sure the new standby data directories do not exist or are empty. If
initdb was run, delete the standby servers' new data directories.

Try your test again *without* running initdb on the replica.

Thanks,

Stephen

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Stephen Frost 2020-12-03 13:14:16 Re: pg_upgrade + replica servers + rsync --size-only is unsafe
Previous Message Rob Emery 2020-12-03 11:41:52 Re: pg_upgrade + replica servers + rsync --size-only is unsafe