public inbox for [email protected]
help / color / mirror / Atom feedFrom: Amit Kapila <[email protected]>
To: Bharath Rupireddy <[email protected]>
Cc: Peter Smith <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Greg Stark <[email protected]>
Cc: Euler Taveira <[email protected]>
Cc: Kyotaro Horiguchi <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: add log messages when replication slots become active and inactive (was Re: Is it worth adding ReplicationSlot active_pid to ReplicationSlotPersistentData?)
Date: Mon, 6 Nov 2023 09:08:53 +0530
Message-ID: <CAA4eK1LPe=7Rb0kR8BGuLye2urNfWs=3idmbU3OfV8VTJU9KCg@mail.gmail.com> (raw)
In-Reply-To: <CALj2ACWjNSA=1hz0yOcrZbZNLVffZ7A5sPqV7_mMLjtMMs_kxQ@mail.gmail.com>
References: <CAM-w4HORsLbxwv8KVUHWu1PxKQLuCN1JjAnXknP8pFNSQfbh3A@mail.gmail.com>
<[email protected]>
<CALj2ACVdPMRBKCLd+XXGg+O9y5g1=0CtWs4bp39dX-J=oe=TTg@mail.gmail.com>
<CAA4eK1K=4dcBn2rcPLai76RZAVgMKmk6xAEgu0CT0p=uHa4TXw@mail.gmail.com>
<CAHut+PtP7nZT0DW6GLPi6hebJJpDx-nOr+TmcsY=gsCk1Te6kw@mail.gmail.com>
<CALj2ACWjNSA=1hz0yOcrZbZNLVffZ7A5sPqV7_mMLjtMMs_kxQ@mail.gmail.com>
On Sun, Nov 5, 2023 at 4:01 AM Bharath Rupireddy
<[email protected]> wrote:
>
> On Thu, Nov 2, 2023 at 7:19 AM Peter Smith <[email protected]> wrote:
> >
> > But that's not quite compatible with what Alvaro [2] had written long
> > back ("... the only acquisitions that would log messages are those in
> > StartReplication and StartLogicalReplication.").
> >
> > In other words, ReplicationSlotAcquire/ReplicationSlotRelease is
> > called by more places than you care to log from.
>
> I refreshed my thoughts for this patch and I think it's enough if
> walsenders alone log messages when slots become active and inactive.
> How about something like the attached v11 patch?
>
+ * This function is currently used only in walsender.
+ */
+void
+ReplicationSlotAcquireAndLog(const char *name, bool nowait)
BTW, is the reason for using it only in walsender is that it is a
background process and it is not very apparent whether the slot is
created, and for foreground processes, it is a bit clear when the
command is executed. If so, the other alternative is to either use a
parameter to the existing function or directly use am_walsender flag
to distinguish when to print the message in acquire/release calls.
Can you please tell me the use case of this additional message?
A few other minor comments:
1.
+ Causes each replication command and related activity to be logged in
+ the server log.
Can we be bit more specific by changing to something like: "Causes
each replication command and slot acquisition/release to be logged in
the server log."
2.
+ ereport(log_replication_commands ? LOG : DEBUG1,
+ (errmsg("walsender process with PID %d acquired %s replication slot \"%s\"",
It seems PID and process name is quite unlike what we print in other
similar messages. For example, see below messages when we start
replication via pub/sub :
2023-11-06 08:41:57.867 IST [24400] LOG: received replication
command: CREATE_REPLICATION_SLOT "sub1" LOGICAL pgoutput (SNAPSHOT
'nothing')
2023-11-06 08:41:57.867 IST [24400] STATEMENT:
CREATE_REPLICATION_SLOT "sub1" LOGICAL pgoutput (SNAPSHOT 'nothing')
...
...
2023-11-06 08:41:57.993 IST [22332] LOG: walsender process with PID
22332 acquired logical replication slot "sub1"
2023-11-06 08:41:57.993 IST [22332] STATEMENT: START_REPLICATION SLOT
"sub1" LOGICAL 0/0 (proto_version '4', origin 'any', publication_names
'"pub1"')
...
...
2023-11-06 08:41:58.015 IST [22332] LOG: starting logical decoding
for slot "sub1"
2023-11-06 08:41:58.015 IST [22332] DETAIL: Streaming transactions
committing after 0/1522730, reading WAL from 0/15226F8.
2023-11-06 08:41:58.015 IST [22332] STATEMENT: START_REPLICATION SLOT
"sub1" LOGICAL 0/0 (proto_version '4', origin 'any', publication_names
'"pub1"')
We can get the PID from the log line as for other logs and I don't see
the process name printed anywhere else.
--
With Regards,
Amit Kapila.
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: add log messages when replication slots become active and inactive (was Re: Is it worth adding ReplicationSlot active_pid to ReplicationSlotPersistentData?)
In-Reply-To: <CAA4eK1LPe=7Rb0kR8BGuLye2urNfWs=3idmbU3OfV8VTJU9KCg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox