[bug fix] pg_ctl always uses the same event source

From: "MauMau" <maumau307(at)gmail(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: [bug fix] pg_ctl always uses the same event source
Date: 2013-12-05 14:24:00
Message-ID: 4F809752C9CC49AC95F48F6A8F24267B@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I've removed a limitation regarding event log on Windows with the attached
patch. I hesitate to admit this is a bug fix and want to regard this an
improvement, but maybe it's a bug fix from users' perspective. Actually, I
received problem reports from some users.

[Problem]
pg_ctl always uses event source "PostgreSQL" to output messages to the event
log. Some example messages are:

server starting
server started

This causes the problems below:

1. Cannot distinguish PostgreSQL instances because they use the same event
source.

2. If you use multiple installations of PostgreSQL on the same machine,
whether they are the same or different versions, Windows event viewer
reports an error "event source not found" in the following sequence. Other
system administration software which deal with event log may show other
anomalies.
2-1 Install the first PostgreSQL (e.g. 9.3) into <dir_1>, register
<dir_1>\lib\pgevent.dll for event source "PostgreSQL", then creates
<instance_1>.
2-2 Install the second PostgreSQL (e.g. 9.2) into <dir_2> as part of some
packaged application, register <dir_2>\lib\pgevent.dll for event source
"PostgreSQL", then creates <instance_2>. The application uses PostgreSQL as
its internal data repository. It sets event_source = 'appname_db' in
<instance_2>'s postgresql.conf.
2-3 At this point, there's no problem.
2-4 Uninstall the second PostgreSQL. <instance_2> is deleted. The packaged
application installer may or may not unregister pgevent.dll with
regsvr32.exe /u. ANyway, <dir_2>\bin\pgevent.dll is deleted.
2-5 <instance_1> continues to run and output messages to event log.
2-6 When you view the messages with event viewer, it reports an error
because the event source "PostgreSQL" and/or pgevent.dll was deleted in 2-4.

[Fix]
Make pg_ctl use event_source setting in postgresql.conf. This eliminates
the need for every instance to use the event source "PostgreSQL" for its
pg_ctl.

Regards
MauMau

Attachment Content-Type Size
pg_ctl_eventsrc.patch application/octet-stream 4.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-12-05 14:24:12 Re: Regression tests failing if not launched on db "regression"
Previous Message Andres Freund 2013-12-05 14:18:17 Re: Performance optimization of btree binary search