Re: Logical Replication Sync Validation

2023-04-18 Thread Laurenz Albe
On Tue, 2023-04-18 at 10:20 +0200, Robert Sjöblom wrote: > 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

Re: Logical Replication Sync Validation

2023-04-18 Thread Christophe Pettus
> On Apr 18, 2023, at 03:45, Robert Sjöblom wrote: > I'm aware of that. But you can, however, do something like: > > SELECT * FROM FOO WHERE CTID = (SELECT MAX(CTID) FROM FOO); > > on both sides. The idea being that if I change FOO, the CTID of the changed > row will not be the same on both

Re: Logical Replication Sync Validation

2023-04-18 Thread Christophe Pettus
> On Apr 18, 2023, at 01:20, Robert Sjöblom wrote: > 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? No. CTIDs aren't sent

Logical Replication Sync Validation

2023-04-18 Thread Robert Sjöblom
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