Logical decoding from promoted standby with same replication slot

Поиск
Список
Период
Сортировка
От Jeremy Finzel
Тема Logical decoding from promoted standby with same replication slot
Дата
Msg-id CAMa1XUhnDJ6qRCbCFScs2gYLa3-MzU9o2crUjw+2UEU=jYFYVg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Logical decoding from promoted standby with same replication slot  (Jeremy Finzel <finzelj@gmail.com>)
Список pgsql-hackers
Hello -

We are working on several DR scenarios with logical decoding.  Although we are using pglogical the question we have I think is generally applicable to logical replication.

Say we have need to drop a logical replication slot for some emergency reason on the master, but we don't want to lose the data permanently.  We can make a point-in-time-recovery snapshot of the master to use in order to recover the lost data in the slot we are about to drop.  Then we drop the slot on master.

We can then point our logical subscription to pull from the snapshot to get the lost data, once we promote it.

The question is that after promotion, logical decoding is looking for a timeline 2 file whereas the file is still at timeline 1.

The WAL file is 00000001000008FD0000003C, for example.  After promotion, it is still 00000001000008FD0000003C in pg_wal.  But logical decoding says ERROR: segment 00000002000008FD0000003C has already been removed (it is looking for a timeline 2 WAL file).  Simply renaming the file actually allows us to stream from the replication slot accurately and recover the data.

But all of this begs the question of an easier way to do this - why doesn't logical decoding know to look for a timeline 1 file?  It is really helpful to have this ability to easily recover logical replicated data from a snapshot of a replication slot, in case of disaster.

All thoughts very welcome!

Thanks,
Jeremy

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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: pgsql: Fix parallel index and index-only scans to fall back toserial.
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [HACKERS] Client Connection redirection support for PostgreSQL