Re: pg_replslotdata - a tool for displaying replication slot information

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема Re: pg_replslotdata - a tool for displaying replication slot information
Дата
Msg-id CALj2ACVpzf3LHvuq9qE2ngfHkmdtN2AcSMysO1LsvUkzu7-VyQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_replslotdata - a tool for displaying replication slot information  ("Bossart, Nathan" <bossartn@amazon.com>)
Ответы Re: pg_replslotdata - a tool for displaying replication slot information  (SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>)
Список pgsql-hackers
On Wed, Dec 1, 2021 at 12:13 AM Bossart, Nathan <bossartn@amazon.com> wrote:
>
> On 11/30/21, 6:14 AM, "Peter Eisentraut" <peter.eisentraut@enterprisedb.com> wrote:
> > On 23.11.21 06:09, Bharath Rupireddy wrote:
> >> The replication slots data is stored in binary format on the disk under
> >> the pg_replslot/<<slot_name>> directory which isn't human readable. If
> >> the server is crashed/down (for whatever reasons) and unable to come up,
> >> currently there's no way for the user/admin/developer to know what were
> >> all the replication slots available at the time of server crash/down to
> >> figure out what's the restart lsn, xid, two phase info or types of slots
> >> etc.
> >
> > What do you need that for?  You can't do anything with a replication
> > slot while the server is down.
>
> One use-case might be to discover the value you need to set for
> max_replication_slots, although it's pretty trivial to discover the
> number of replication slots by looking at the folder directly.

Apart from the above use-case, one can do some exploratory analysis on
the replication slot information after the server crash, this may be
useful for RCA or debugging purposes, for instance:
1) to look at the restart_lsn of the slots to get to know why there
were many WAL files filled up on the disk (because of the restart_lsn
being low)
2) to know how many replication slots available at the time of crash,
if required, one can choose to drop selective replication slots or the
ones that were falling behind to make the server up
3) if we persist active_pid info of the replication slot to the
disk(currently we don't have this info in the disk), one can get to
know the inactive replication slots at the time of crash
4) if the primary server is down and failover were to happen on to the
standby, by looking at the replication slot information on the
primary, one can easily recreate the slots on the standby

> However, you also need to know how many replication origins there are,
> and AFAIK there isn't an easy way to read the replorigin_checkpoint
> file at the moment.  IMO a utility like this should also show details
> for the replication origins.  I don't have any other compelling use-
> cases at the moment, but I will say that it is typically nice from an
> administrative standpoint to be able to inspect things like this
> without logging into a running server.

Yeah, this can be added too, probably as an extra option to the
proposed pg_replslotdata tool. But for now, let's deal with the
replication slot information alone and once this gets committed, we
can extend it further for replication origin info.

Regards,
Bharath Rupireddy.



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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: Rename dead_tuples to dead_items in vacuumlazy.c
Следующее
От: vignesh C
Дата:
Сообщение: Re: Optionally automatically disable logical replication subscriptions on error