Re: Logical replication and restore from pg_basebackup - Mailing list pgsql-hackers

From Alexey Kondratov
Subject Re: Logical replication and restore from pg_basebackup
Date
Msg-id 67d1c1d6-420f-5c4d-dfc3-50c402e487d7@postgrespro.ru
Whole thread Raw
In response to Logical replication and restore from pg_basebackup  (Dmitry Vasiliev <dmitry.vasiliev@coins.ph>)
List pgsql-hackers
Hi Dmitry,

On 11.02.2019 17:39, Dmitry Vasiliev wrote:
> What is the scope of logical replication if I cannot make recovery 
> from pg_basebackup?


No, you can, but there are some things to keep in mind:

1) I could be wrong, but usage of pgbench in such a test seems to be a 
bad idea, since it drops and creates tables from the scratch, when -i is 
passed. However, if I recall it correctly, pub/sub slots use OIDs of 
relations, so I expect that you should get only initial sync data on 
replica and last pgbench results on master.

2) Next, 'srsubstate' check works only for initial sync. After that you 
should poll master's replication slot lsn for 'pg_current_wal_lsn() <= 
replay_lsn'.

Please, find attached a slightly modified version of your test (and gist 
[1]), which works just fine. You should replace %username% with your 
current username, since I did not run it as postgres user.

[1] https://gist.github.com/ololobus/a8a11f11eb67dfa1b6a95bff5e8f0096


Regards

-- 
Alexey Kondratov

Postgres Professional https://www.postgrespro.com
Russian Postgres Company


Attachment

pgsql-hackers by date:

Previous
From: Antonin Houska
Date:
Subject: Re: Problems with plan estimates in postgres_fdw
Next
From: Oleksii Kliukin
Date:
Subject: Re: Connection slots reserved for replication