Thread: pg_autovacuum Win32 Service Code

pg_autovacuum Win32 Service Code

From
"Dave Page"
Date:
Some time ago I posted a patch to allow pg_autovacuum to be run as a
service on Windows, on the understanding that if pg_autovacuum didn't
make it into the backend, it would be applied. I followed up Tom's
message to Matthew apologising for not including his backend integration
patches with a request that the patch be applied to allow use by Windows
users.

It appears this didn't happen for beta 1 - can it be done for beta 2 so
Win32 users can benefit from it please?

Regards, Dave.

Re: pg_autovacuum Win32 Service Code

From
Tom Lane
Date:
"Dave Page" <dpage@vale-housing.co.uk> writes:
> Some time ago I posted a patch to allow pg_autovacuum to be run as a
> service on Windows, on the understanding that if pg_autovacuum didn't
> make it into the backend, it would be applied. I followed up Tom's
> message to Matthew apologising for not including his backend integration
> patches with a request that the patch be applied to allow use by Windows
> users.

I held off doing anything about this for beta1 because I wanted
Matthew's input first, and he was going to be gone over the weekend.
Hopefully he's returned now and can comment on whether he sees any
problem.

In the meantime it certainly belongs on our open-issues list.

            regards, tom lane

Re: pg_autovacuum Win32 Service Code

From
Bruce Momjian
Date:
Tom Lane wrote:
> "Dave Page" <dpage@vale-housing.co.uk> writes:
> > Some time ago I posted a patch to allow pg_autovacuum to be run as a
> > service on Windows, on the understanding that if pg_autovacuum didn't
> > make it into the backend, it would be applied. I followed up Tom's
> > message to Matthew apologising for not including his backend integration
> > patches with a request that the patch be applied to allow use by Windows
> > users.
>
> I held off doing anything about this for beta1 because I wanted
> Matthew's input first, and he was going to be gone over the weekend.
> Hopefully he's returned now and can comment on whether he sees any
> problem.
>
> In the meantime it certainly belongs on our open-issues list.

It is already there:

---------------------------------------------------------------------------

                               P O S T G R E S Q L

                          8 . 0  O P E N    I T E M S


Current version at ftp://momjian.postgresql.org/pub/postgresql/open_items.

Changes
-------
* Win32
    o binary version stamps
    o signal safe socket handler
    o query cancel in psql (?)
        o Report correct errno codes from native Windows system calls
    o Shorten timezone for %t log_line_prefix
-->    o start pg_autovacuum easily
    o fix pitr file copy syntax
* fix dbsize and oid2name for tablespaces
* allow libpq to check parameterized data types
* make pgxs install the default
* add xid to log_line_prefix for PITR
* add psql tab completion for tablespaces
* cleanup FRONTEND use in /port, malloc, elog

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_autovacuum Win32 Service Code

From
"Matthew T. O'Connor"
Date:
Tom Lane wrote:

> "Dave Page" <dpage@vale-housing.co.uk> writes:
>>Some time ago I posted a patch to allow pg_autovacuum to be run as a
>>service on Windows, on the understanding that if pg_autovacuum didn't
>>make it into the backend, it would be applied. I followed up Tom's
>>message to Matthew apologising for not including his backend integration
>>patches with a request that the patch be applied to allow use by Windows
>>users.
>
> I held off doing anything about this for beta1 because I wanted
> Matthew's input first, and he was going to be gone over the weekend.
> Hopefully he's returned now and can comment on whether he sees any
> problem.

I am back, and caught up on email now.

I took a quick look at the patch Dave submitted to the pathes list on
5/11/04 (Let me know if I looked at the wrong one).  Without having
actually having applied the patch or tried it out, it looks OK to me.
Basically it just adds a few command line options and related code that
tells pg_autovacuum to (un)register itself as a service, adds a handler
for service manager requests and changes the the logging to use the
windows event log.

One comment: IMHO the pg_autovacuum service should probably be dependant
on the PostgreSQL service.  This will cooridinate their respective
startups and shutdowns, and will prevent pg_autovacuum from exiting with
an error message about not able to connect to the postmaster.

Dave, do you plan on having the windows installer automatically install
pg_autovacuum and setup the service?

Matthew


Re: pg_autovacuum Win32 Service Code

From
"Dave Page"
Date:

> -----Original Message-----
> From: Matthew T. O'Connor [mailto:matthew@zeut.net]
> Sent: 10 August 2004 21:41
> To: Tom Lane
> Cc: Dave Page; PostgreSQL-development;
> pgsql-hackers-win32@postgresql.org; Bruce Momjian
> Subject: Re: [HACKERS] pg_autovacuum Win32 Service Code
>
> One comment: IMHO the pg_autovacuum service should probably
> be dependant on the PostgreSQL service.  This will
> cooridinate their respective startups and shutdowns, and will
> prevent pg_autovacuum from exiting with an error message
> about not able to connect to the postmaster.

Yes, agreed - the problem with that is that we don't know the name of
the service until it's been installed (as the user can change it), and
even then we only know it if it's been installed by the installer which
logs the service details in a known section of the registry for apps
like pgAdmin to find and use.

I believe I can setup all of that in the installer and avoid using the
install-as-service option in a normal installation - anyone who does
want to use that option will have to manually add the correct
dependency.

> Dave, do you plan on having the windows installer
> automatically install pg_autovacuum and setup the service?

Yup.

Regards Dave