Re: add log messages when replication slots become active and inactive (was Re: Is it worth adding ReplicationSlot active_pid to ReplicationSlotPersistentData?)

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: add log messages when replication slots become active and inactive (was Re: Is it worth adding ReplicationSlot active_pid to ReplicationSlotPersistentData?)
Date: 2022-07-25 13:01:55
Message-ID: CALj2ACWKKGdgUXGo-zgGg6eBKw9gGwgeAFr3xhzx=H+rLGM_dA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 5, 2022 at 2:57 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Fri, Apr 29, 2022 at 4:02 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> >
> > If I read the code right, this patch emits logs when
> > pg_logical_slot_get_changes and pg_replication_slot_advance SQL
> > functions are called. Is this desirable/useful, for the use case you
> > stated at start of thread? I think it is most likely pointless. If you
> > get rid of those, then the only acquisitions that would log messages are
> > those in StartReplication and StartLogicalReplication. So I wonder if
> > it would be better to leave the API of ReplicationSlotAcquire() alone,
> > and instead make StartReplication and StartLogicalReplication
> > responsible for those messages.
> >
> > I didn't look at the release-side messages you're adding, but I suppose
> > it should be symmetrical.

Here's the v6 patch, a much simpler one - no changes to any of the
existing function APIs. Please see the sample logs at [1]. There's a
bit of duplicate code in the v6 patch, if the overall approach looks
okay, I can remove that too in the next version of the patch.

Thoughts?

[1]
2022-07-25 12:30:14.847 UTC [152873] LOG: acquired physical
replication slot "foo"
2022-07-25 12:30:20.878 UTC [152873] LOG: released physical
replication slot "foo"

2022-07-25 12:49:18.023 UTC [168738] LOG: acquired logical
replication slot "bar"
2022-07-25 12:49:28.105 UTC [168738] LOG: released logical
replication slot "bar"

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v6-0001-Add-LOG-messages-when-replication-slots-become-ac.patch application/x-patch 4.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-07-25 13:28:24 Re: COPY FROM FORMAT CSV FORCE_NULL(*) ?
Previous Message Pavel Borisov 2022-07-25 13:00:49 Re: Custom tuplesorts for extensions