Logical Replication Sync Validation

Поиск
Список
Период
Сортировка
От Robert Sjöblom
Тема Logical Replication Sync Validation
Дата
Msg-id 81990e48-56c3-21c5-7dcc-25725522c495@fortnox.se
обсуждение исходный текст
Ответы Re: Logical Replication Sync Validation  (Christophe Pettus <xof@thebuild.com>)
Re: Logical Replication Sync Validation  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-general
Greetings,

We have the following setup:
A pg10 cluster with logical replication to a pg15 cluster, set up with
the following query:
CREATE PUBLICATION "dbname_pub" FOR ALL TABLES;

We do an initial sync of DDL with pg_dump. The purpose of the
replication is to perform an online upgrade with minimal downtime.

At the moment where we would switch to pg15 being the primary/lead we
will stop writes to pg10; at that point we will validate that we are
fully in sync, tear down pg10 and send writes to pg15. Our question is
how we can validate our sync status. Given that there have been no DDL
changes on pg10 (new tables, for instance), would the following check be
sufficient?

Compare byte diff between WAL LSNs:
SELECT abs(pg_wal_lsn_diff(write_lsn, flush_lsn)) AS lag FROM
pg_stat_replication;

If the byte diff is 0, I would assume that we're fully in sync. Is this
understanding correct?

Another idea we've had would be to use CTID to fetch the last row
(update/insert) in each table on both sides and compare row content, is
this feasible? Is it safe to rely on CTIDs across logical replication?

best regards,
Robert Sjöblom

--
Innehållet i detta e-postmeddelande är konfidentiellt och avsett endast för
adressaten.Varje spridning, kopiering eller utnyttjande av innehållet är
förbjuden utan tillåtelse av avsändaren. Om detta meddelande av misstag
gått till fel adressat vänligen radera det ursprungliga meddelandet och
underrätta avsändaren via e-post



В списке pgsql-general по дате отправления:

Предыдущее
От: gayathri ramesh
Дата:
Сообщение: Request for information about postgres version 15.2 stability
Следующее
От: Christophe Pettus
Дата:
Сообщение: Re: Logical Replication Sync Validation