|
Home > Archive > Slony1 PostgreSQL Replication > August 2005 > win32 service code
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
win32 service code
|
|
| Magnus Hagander 2005-08-07, 11:23 am |
| Hi,
here is a first attempt at win32 service integration. It uses option 3
per the previous mail - this was actually also the easiest to do, even
easier than option 1.
It will look for a list of config files in the Engine subkey of the
service configuration parameters in the registry - one entry per file,
the name of the value is ignored, just the filename is read. It will
launch a slon.exe for each of these specifying the config file. If one
of the processes die while the service is running, it will be restarted.
When the service is shut down, all slon.exe processes are killed hard.
It also contains eventlog integration code, since you can't log to
stdout/stderr whlie running as a service. It's only activated when
started as a service (set using a global variable). We still write the
log to stdout when running as a service, in case extra debugging is
needed.
Finally, it fixes a bug in the logging code which failed to initialize
outbuf to the empty string if log_timestamp and log_pid were both off.
The files "win32service.c|h" go in the port directory.
//Magnus
| |
| Dave Page 2005-08-10, 8:25 pm |
|
I will apply this within a day or two if there are no objections.
Regards, Dave.
-----Original Message-----
From: "Magnus Hagander"<mha- +PAb3xVejjn11pZQbBMD
iQ@public.gmane.org>
Sent: 07/08/05 17:08:44
To: =
"slony1-general- AuKwsB3Fm+ugFIWk8tvy
RWD2FQJk+8+b@public.gmane.org"<slony1-general- AuKwsB3Fm+ugFIWk8tvy
RWD2FQJk+8+b@public.gmane.org=
>
Subject: [Slony1-general] win32 service code
Hi,
here is a first attempt at win32 service integration. It uses option 3
per the previous mail - this was actually also the easiest to do, even
easier than option 1.=20
It will look for a list of config files in the Engine subkey of the
service configuration parameters in the registry - one entry per file,
the name of the value is ignored, just the filename is read. It will
launch a slon.exe for each of these specifying the config file. If one
of the processes die while the service is running, it will be restarted.
When the service is shut down, all slon.exe processes are killed hard.
It also contains eventlog integration code, since you can't log to
stdout/stderr whlie running as a service. It's only activated when
started as a service (set using a global variable). We still write the
log to stdout when running as a service, in case extra debugging is
needed.
Finally, it fixes a bug in the logging code which failed to initialize
outbuf to the empty string if log_timestamp and log_pid were both off.
The files "win32service.c|h" go in the port directory.
//Magnus
-----Unmodified Original Message-----
Hi,
here is a first attempt at win32 service integration. It uses option 3
per the previous mail - this was actually also the easiest to do, even
easier than option 1.=20
It will look for a list of config files in the Engine subkey of the
service configuration parameters in the registry - one entry per file,
the name of the value is ignored, just the filename is read. It will
launch a slon.exe for each of these specifying the config file. If one
of the processes die while the service is running, it will be restarted.
When the service is shut down, all slon.exe processes are killed hard.
It also contains eventlog integration code, since you can't log to
stdout/stderr whlie running as a service. It's only activated when
started as a service (set using a global variable). We still write the
log to stdout when running as a service, in case extra debugging is
needed.
Finally, it fixes a bug in the logging code which failed to initialize
outbuf to the empty string if log_timestamp and log_pid were both off.
The files "win32service.c|h" go in the port directory.
//Magnus
| |
| Hiroshi Saito 2005-08-10, 8:25 pm |
| > I will apply this within a day or two if there are no objections.
>
> Regards, Dave.
Yea!
BTW, The place of sleventlog module.
src/slon/slevent/ ?
src/bin/slevent/ ?
Are where good as for directory composition?
Regards,
Hiroshi Saito
| |
| Magnus Hagander 2005-08-11, 3:25 am |
| > > I will apply this within a day or two if there are no objections.
>=20
> Yea!
> BTW, The place of sleventlog module.
> src/slon/slevent/ ?
> src/bin/slevent/ ?
> Are where good as for directory composition?=20
I am not sure. Another idea is to just use the pgevent.dll from
postgresql. It's just an empty DLL file after all... And since you're
most likely never going to use slony on a machine that doesn't have
postgresql installed, it should always be available.
If not, I think src/slevent would be the place, to make it follow the
layout of the others.
//Magnus
| |
| Dave Page 2005-08-11, 3:25 am |
| =20
> -----Original Message-----
> From: Magnus Hagander [mailto:mha- +PAb3xVejjn11pZQbBMD
iQ@public.gmane.org]=20
> Sent: 11 August 2005 08:58
> To: Hiroshi Saito; Dave Page; slony1-general- AuKwsB3Fm+ugFIWk8tvy
RWD2FQJk+8+b@public.gmane.org
> Subject: RE: [Slony1-general] win32 service code
>=20
>=20
> I am not sure. Another idea is to just use the pgevent.dll from
> postgresql. It's just an empty DLL file after all... And since you're
> most likely never going to use slony on a machine that doesn't have
> postgresql installed, it should always be available.
>=20
> If not, I think src/slevent would be the place, to make it follow the
> layout of the others.
I think it probably should be included - we have our own for pgAgent,
just so we can be sure of where it is, and so that it can run standalone
in the odd instance in which someone might want to do so.
I also think src/slevent, assuming the Unix folks are happy with that.
(Just for info, this is a small DLL that is used to format messages in
the Windows event log. It can be shared by all parts of Slony that need
to use it, though mainly it will be used by Slon).
Regards, Dave.
| |
| Dave Page 2005-08-12, 7:25 am |
| Patch applied.
Regards, Dave=20
> -----Original Message-----
> From: slony1-general-bounces- AuKwsB3Fm+ugFIWk8tvy
RWD2FQJk+8+b@public.gmane.org=20
> [mailto:slony1-general-bounces- AuKwsB3Fm+ugFIWk8tvy
RWD2FQJk+8+b@public.gmane.org] On=20
> Behalf Of Magnus Hagander
> Sent: 07 August 2005 17:05
> To: slony1-general- AuKwsB3Fm+ugFIWk8tvy
RWD2FQJk+8+b@public.gmane.org
> Subject: [Slony1-general] win32 service code
>=20
> Hi,
>=20
>=20
> here is a first attempt at win32 service integration. It uses option 3
> per the previous mail - this was actually also the easiest to do, even
> easier than option 1.=20
> It will look for a list of config files in the Engine subkey of the
> service configuration parameters in the registry - one entry per file,
> the name of the value is ignored, just the filename is read. It will
> launch a slon.exe for each of these specifying the config file. If one
> of the processes die while the service is running, it will be=20
> restarted.
> When the service is shut down, all slon.exe processes are killed hard.
>=20
> It also contains eventlog integration code, since you can't log to
> stdout/stderr whlie running as a service. It's only activated when
> started as a service (set using a global variable). We still write the
> log to stdout when running as a service, in case extra debugging is
> needed.
>=20
> Finally, it fixes a bug in the logging code which failed to initialize
> outbuf to the empty string if log_timestamp and log_pid were both off.
>=20
> The files "win32service.c|h" go in the port directory.
>=20
> //Magnus
>=20
|
|
|
|
|