public inbox for [email protected]
help / color / mirror / Atom feedFrom: Japin Li <[email protected]>
To: Euler Taveira <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: [email protected]
Subject: Re: log_min_messages per backend type
Date: Fri, 1 Aug 2025 13:53:33 +0800
Message-ID: <ME0P300MB04454F2F47351AEC1A1B8C12B626A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<y5tgui75jrcj6mm5nmoq4yqwage2432akx4kp2ogtcnim3wskx@2ipmtfi4qvpi>
<[email protected]>
On Thu, Jul 31, 2025 at 11:19:48AM -0300, Euler Taveira wrote:
> On Thu, Mar 6, 2025, at 10:33 AM, Andres Freund wrote:
> > Huh, the startup process is among the most crucial things to monitor?
> >
>
> Good point. Fixed.
>
> After collecting some suggestions, I'm attaching a new patch contains the
> following changes:
>
> - patch was rebased
> - include Alvaro's patch (v2-0001) [1] as a basis for this patch
> - add ioworker as new backend type
> - add startup as new backend type per Andres suggestion
> - small changes into documentation
>
> > I don't know what I think about the whole patch, but I do want to voice
> > *strong* opposition to duplicating a list of all backend types into multiple
> > places. It's already painfull enough to add a new backend type, without having
> > to pointlessly go around and manually add a new backend type to mulltiple
> > arrays that have completely predictable content.
> >
>
> I'm including Alvaro's patch as is just to make the CF bot happy and to
> illustrate how it would be if we adopt his solution to centralize the list of
> backend types. I think Alvaro's proposal overcomes the objection [2], right?
>
I think we can avoid memory allocation by using pg_strncasecmp().
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 5c769dd7bcc..f854b2fac93 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -1343,14 +1343,10 @@ check_log_min_messages(char **newval, void **extra, GucSource source)
}
else
{
- char *loglevel;
- char *btype;
- bool found = false;
- btype = palloc((sep - tok) + 1);
- memcpy(btype, tok, sep - tok);
- btype[sep - tok] = '\0';
- loglevel = pstrdup(sep + 1);
+ char *btype = tok;
+ char *loglevel = sep + 1;
+ bool found = false;
/* Is the log level valid? */
for (entry = server_message_level_options; entry && entry->name; entry++)
@@ -1377,7 +1373,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source)
found = false;
for (int i = 0; i < BACKEND_NUM_TYPES; i++)
{
- if (pg_strcasecmp(log_min_messages_backend_types[i], btype) == 0)
+ if (pg_strncasecmp(log_min_messages_backend_types[i], btype, sep - tok) == 0)
{
/* Reject duplicates for a backend type. */
if (assigned[i])
--
Best regards,
Japin Li
ChengDu WenWu Information Technology Co., LTD.
view thread (28+ 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]
Subject: Re: log_min_messages per backend type
In-Reply-To: <ME0P300MB04454F2F47351AEC1A1B8C12B626A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.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