Re: [bug fix] pg_ctl always uses the same event source - Mailing list pgsql-hackers

From MauMau
Subject Re: [bug fix] pg_ctl always uses the same event source
Date
Msg-id 5553938042D84B1D9B280D937B042AF8@maumau
Whole thread Raw
In response to Re: [bug fix] pg_ctl always uses the same event source  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: [bug fix] pg_ctl always uses the same event source
List pgsql-hackers
Hi, Amit san,

From: "Amit Kapila" <amit.kapila16@gmail.com>
>> [elog.c]
>> Writing the default value in this file was redundant, because
>> event_source
>> cannot be NULL.  So change
>>
> I think this change might not be safe as write_eventlog() gets called
> from write_stderr() which might get called
> before reading postgresql.conf, so the code as exists in PG might be
> to handle that case or some other similar
> situation where event_source is still not set. Have you confirmed in
> all ways that it is never the case that
> event_source is not set when the control reaches this function.

Yes, you are right.  I considered this again after replying to your previous
mail, and found out write_stderr() calls write_eventlog().  In that case,
event_source is still NULL before GUC initialization.

Please find attached the patch.
I put the default event source name in one place -- pg_config_manual.h,
which seems the best place.  This could eliminate duplicate default values
in four places: pgevent.c, pg_ctl.c, elog.c, and guc.c.  Thanks to your
review and comment, the code got cleaner and correct.  Thank you very much.

Regards
MauMau

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Time-Delayed Standbys
Next
From: Simon Riggs
Date:
Subject: Re: autovacuum_work_mem