Re: [bug fix] pg_ctl always uses the same event source

From: "MauMau" <maumau307(at)gmail(dot)com>
To: "Amit Kapila" <amit(dot)kapila16(at)gmail(dot)com>
Cc: "Magnus Hagander" <magnus(at)hagander(dot)net>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [bug fix] pg_ctl always uses the same event source
Date: 2013-12-12 11:13:18
Message-ID: 5553938042D84B1D9B280D937B042AF8@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Amit san,

From: "Amit Kapila" <amit(dot)kapila16(at)gmail(dot)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 Content-Type Size
pg_ctl_eventsrc_v2.patch application/octet-stream 7.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2013-12-12 11:19:47 Re: autovacuum_work_mem
Previous Message Andres Freund 2013-12-12 11:05:05 Re: Time-Delayed Standbys