pg_upgrade + replica servers + rsync --size-only is unsafe - Mailing list pgsql-admin

From Rob Emery
Subject pg_upgrade + replica servers + rsync --size-only is unsafe
Date
Msg-id CAPCETpv6esrADG8koCxzwUWAz4iJCjKt4aCcdZS09mB-y9TwsQ@mail.gmail.com
Whole thread Raw
Responses Re: pg_upgrade + replica servers + rsync --size-only is unsafe  (Stephen Frost <sfrost@snowman.net>)
List pgsql-admin
Hiya,

We're pretty sure that we've just hit a scenario where the instructions for pg_upgrade with standby servers aren't quite safe.

We were testing our upgrade process with a copy of our live cluster in a lab environment and we found that using

rsync --verbose --archive --delete --hard-links --size-only --no-inc-recursive /media/postgresql/data/main /media/postgresql/data/9.6 PGRETESTA02:/media/postgresql/data

Resulted in:
2020-12-02 14:49:11.513 GMT [20884-1] LOG:  database system was shut down in recovery at 2020-12-02 13:57:56 GMT
2020-12-02 14:49:11.513 GMT [20884-2] LOG: entering standby mode
2020-12-02 14:49:11.557 GMT [20884-3] LOG: consistent recovery state reached at 19E/25000098
2020-12-02 14:49:11.557 GMT [20884-4] LOG: invalid record length at 19E/25000098: wanted 24, got 0
2020-12-02 14:49:11.559 GMT [20883-1] LOG: database system is ready to accept read only connections
2020-12-02 14:49:11.593 GMT [20888-1] FATAL: database system identifier differs between the primary and standby
2020-12-02 14:49:11.593 GMT [20888-2] DETAIL: The primary's identifier is 6901669428825624285, the standby's identifier is 690161835164
1138930.
however if we don't use --size-only, then the process worked fine and we a smooth upgrade.

I think the documentation should be updated to not have --size-only?

I've had a look and I can see concerns around this when it was originally added: https://www.postgresql.org/message-id/20150123030509.GJ3854@tamriel.snowman.net

Thanks,
Rob



pgsql-admin by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: killing idle_connections
Next
From: Stephen Frost
Date:
Subject: Re: pg_upgrade + replica servers + rsync --size-only is unsafe