pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Support configurable eventlog application names on Windows
6+ messages / 4 participants
[nested] [flat]
* pgsql: Support configurable eventlog application names on Windows
@ 2011-10-25 18:05 Magnus Hagander <magnus@hagander.net>
0 siblings, 3 replies; 6+ messages in thread
From: Magnus Hagander @ 2011-10-25 18:05 UTC (permalink / raw)
To: pgsql-committers
Support configurable eventlog application names on Windows
This allows different instances to use the eventlog with different
identifiers, by setting the event_source GUC, similar to how
syslog_ident works.
Original patch by MauMau, heavily modified by Magnus Hagander
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/d8ea33f2c02721c89c2434b9fda170afb7fe4999
Modified Files
--------------
doc/src/sgml/config.sgml | 25 +++++++++++
doc/src/sgml/installation.sgml | 13 ------
doc/src/sgml/runtime.sgml | 46 +++++++++++++++++++
src/backend/utils/error/elog.c | 3 +-
src/backend/utils/misc/guc.c | 14 ++++++
src/backend/utils/misc/postgresql.conf.sample | 2 +
src/bin/pgevent/pgevent.c | 58 ++++++++++++++++++++++--
src/bin/pgevent/pgevent.def | 1 +
8 files changed, 143 insertions(+), 19 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql: Support configurable eventlog application names on Windows
@ 2011-10-25 20:21 Jaime Casanova <jaime@2ndquadrant.com>
parent: Magnus Hagander <magnus@hagander.net>
2 siblings, 1 reply; 6+ messages in thread
From: Jaime Casanova @ 2011-10-25 20:21 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-committers
On Tue, Oct 25, 2011 at 1:05 PM, Magnus Hagander <magnus@hagander.net> wrote:
> Support configurable eventlog application names on Windows
>
> This allows different instances to use the eventlog with different
> identifiers, by setting the event_source GUC, similar to how
> syslog_ident works.
>
if i uncomment event_source in a linux env i get this error:
"""
LOG: unrecognized configuration parameter "event_source" in file
"/usr/local/pgsql/9.2/data/postgresql.conf" line 326
FATAL: configuration file "/usr/local/pgsql/9.2/data/postgresql.conf"
contains errors
"""
this is because the definition of the GUC is inside an #ifdef, but the
error message is not very informative...
so, i tried to add a check_event_source (attached) and the error now
looks like this
"""
LOG: 22023: event_source can only be setted in windows builds
LOCATION: call_string_check_hook, guc.c:8172
FATAL: XX000: failed to initialize event_source to "PostgreSQL"
LOCATION: InitializeOneGUCOption, guc.c:3959
"""
--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
Attachments:
check_event_source.patch (text/x-patch, 1.9K) download
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
new file mode 100644
index 0b1c912..e7d4b85
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
*************** static int syslog_facility = 0;
*** 177,182 ****
--- 177,183 ----
static void assign_syslog_facility(int newval, void *extra);
static void assign_syslog_ident(const char *newval, void *extra);
static void assign_session_replication_role(int newval, void *extra);
+ static bool check_event_source(char **newval, void **extra, GucSource source);
static bool check_temp_buffers(int *newval, void **extra, GucSource source);
static bool check_phony_autocommit(bool *newval, void **extra, GucSource source);
static bool check_debug_assertions(bool *newval, void **extra, GucSource source);
*************** static struct config_string ConfigureNam
*** 2820,2826 ****
NULL, assign_syslog_ident, NULL
},
- #ifdef WIN32
{
{"event_source", PGC_POSTMASTER, LOGGING_WHERE,
gettext_noop("Sets the application name used to identify"
--- 2821,2826 ----
*************** static struct config_string ConfigureNam
*** 2829,2837 ****
},
&event_source,
"PostgreSQL",
! NULL, NULL, NULL
},
- #endif
{
{"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
--- 2829,2836 ----
},
&event_source,
"PostgreSQL",
! check_event_source, NULL, NULL
},
{
{"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
*************** assign_syslog_ident(const char *newval,
*** 8301,8306 ****
--- 8300,8315 ----
/* Without syslog support, it will always be set to "none", so ignore */
}
+ static bool
+ check_event_source(char **newval, void **extra, GucSource source)
+ {
+ #ifndef WIN32
+ GUC_check_errmsg("event_source can only be setted in windows builds");
+ return false;
+ #endif
+
+ return true;
+ }
static void
assign_session_replication_role(int newval, void *extra)
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql: Support configurable eventlog application names on Windows
@ 2011-10-25 20:40 Magnus Hagander <magnus@hagander.net>
parent: Jaime Casanova <jaime@2ndquadrant.com>
0 siblings, 0 replies; 6+ messages in thread
From: Magnus Hagander @ 2011-10-25 20:40 UTC (permalink / raw)
To: Jaime Casanova <jaime@2ndquadrant.com>; +Cc: pgsql-committers
On Tue, Oct 25, 2011 at 22:21, Jaime Casanova <jaime@2ndquadrant.com> wrote:
> On Tue, Oct 25, 2011 at 1:05 PM, Magnus Hagander <magnus@hagander.net> wrote:
>> Support configurable eventlog application names on Windows
>>
>> This allows different instances to use the eventlog with different
>> identifiers, by setting the event_source GUC, similar to how
>> syslog_ident works.
>>
>
> if i uncomment event_source in a linux env i get this error:
> """
> LOG: unrecognized configuration parameter "event_source" in file
> "/usr/local/pgsql/9.2/data/postgresql.conf" line 326
> FATAL: configuration file "/usr/local/pgsql/9.2/data/postgresql.conf"
> contains errors
> """
>
> this is because the definition of the GUC is inside an #ifdef, but the
> error message is not very informative...
> so, i tried to add a check_event_source (attached) and the error now
> looks like this
>
> """
> LOG: 22023: event_source can only be setted in windows builds
> LOCATION: call_string_check_hook, guc.c:8172
> FATAL: XX000: failed to initialize event_source to "PostgreSQL"
> LOCATION: InitializeOneGUCOption, guc.c:3959
> """
Ugh, you are right. I thought I had fixed that, but it seems not. Will fix.
I think the proper fix is to just remove the #ifdef though. There's
precedent with e.g. syslog_ident, that we just ignore the setting if
it's not supported on that platform.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql: Support configurable eventlog application names on Windows
@ 2011-10-26 14:41 Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
parent: Magnus Hagander <magnus@hagander.net>
2 siblings, 1 reply; 6+ messages in thread
From: Heikki Linnakangas @ 2011-10-26 14:41 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-committers
On 25.10.2011 21:05, Magnus Hagander wrote:
> Support configurable eventlog application names on Windows
>
> This allows different instances to use the eventlog with different
> identifiers, by setting the event_source GUC, similar to how
> syslog_ident works.
>
> Original patch by MauMau, heavily modified by Magnus Hagander
Looks like the MinGw build didn't like this. Per frogmouth:
pgevent.o: In function `DllInstall':
c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3916/../pgsql/src/bin/pgevent/pgevent.c:48:
undefined reference to `wcstombs_s'
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql: Support configurable eventlog application names on Windows
@ 2011-10-26 15:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: Magnus Hagander <magnus@hagander.net>
2 siblings, 0 replies; 6+ messages in thread
From: Tom Lane @ 2011-10-26 15:23 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: pgsql-committers
Magnus Hagander <magnus@hagander.net> writes:
> Support configurable eventlog application names on Windows
Some of the buildfarm members still don't like this patch ...
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgsql: Support configurable eventlog application names on Windows
@ 2011-10-26 16:53 Magnus Hagander <magnus@hagander.net>
parent: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
0 siblings, 0 replies; 6+ messages in thread
From: Magnus Hagander @ 2011-10-26 16:53 UTC (permalink / raw)
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; +Cc: pgsql-committers
On Wed, Oct 26, 2011 at 16:41, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> On 25.10.2011 21:05, Magnus Hagander wrote:
>>
>> Support configurable eventlog application names on Windows
>>
>> This allows different instances to use the eventlog with different
>> identifiers, by setting the event_source GUC, similar to how
>> syslog_ident works.
>>
>> Original patch by MauMau, heavily modified by Magnus Hagander
>
> Looks like the MinGw build didn't like this. Per frogmouth:
>
> pgevent.o: In function `DllInstall':
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3916/../pgsql/src/bin/pgevent/pgevent.c:48:
> undefined reference to `wcstombs_s'
Ugh. Seems MingW doesn't support this basic API, which seems to have
been added in Windows 95..
Will fix.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2011-10-26 16:53 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25 18:05 pgsql: Support configurable eventlog application names on Windows Magnus Hagander <magnus@hagander.net>
2011-10-25 20:21 ` Jaime Casanova <jaime@2ndquadrant.com>
2011-10-25 20:40 ` Magnus Hagander <magnus@hagander.net>
2011-10-26 14:41 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2011-10-26 16:53 ` Magnus Hagander <magnus@hagander.net>
2011-10-26 15:23 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox