David Ford wrote:
> 
> Is the best method of reloading pg_hba.conf to SIGHUP the master process?

You dont need to reload it. It all happens automatically - just edit it
and
it will be consulted at next connect.

--------------
Hannu

Sat, 10 Nov 2001 00:57:00 +0500
Hannu Krosing <hannu@tm.ee>
Re: best method of reloading pg_hba.conf
Bruce Momjian wrote:
> 
> > Is the best method of reloading pg_hba.conf to SIGHUP the master process?
> 
> In 7.2, yes, pg_ctl restart or SIGHUP.  On 7.1.X pg_hba.conf is reread
> on every connection request.

Why was it changed ?

--------
Hannu

Sat, 10 Nov 2001 01:32:31 +0500
Hannu Krosing <hannu@tm.ee>
Re: best method of reloading pg_hba.conf
Bruce Momjian wrote:
> 
> > Bruce Momjian wrote:
> > >
> > > > Is the best method of reloading pg_hba.conf to SIGHUP the master process?
> > >
> > > In 7.2, yes, pg_ctl restart or SIGHUP.  On 7.1.X pg_hba.conf is reread
> > > on every connection request.
> >
> > Why was it changed ?
> 
> Performance.  Peter E found that considerable startup time was being
> wasted reading the file.

But can't we read it only when needed ?

Just stat'ing it should be much cheaper than reading it each time.

----------------
Hannu

Sat, 10 Nov 2001 01:43:55 +0500
Hannu Krosing <hannu@tm.ee>
Re: best method of reloading pg_hba.conf
Is the best method of reloading pg_hba.conf to SIGHUP the master process?

David



Fri, 09 Nov 2001 17:03:58 -0500
David Ford <david@blue-labs.org>
best method of reloading pg_hba.conf
> Is the best method of reloading pg_hba.conf to SIGHUP the master process?

In 7.2, yes, pg_ctl restart or SIGHUP.  On 7.1.X pg_hba.conf is reread
on every connection request.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Fri, 9 Nov 2001 17:44:26 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: best method of reloading pg_hba.conf
> Bruce Momjian wrote:
> > 
> > > Is the best method of reloading pg_hba.conf to SIGHUP the master process?
> > 
> > In 7.2, yes, pg_ctl restart or SIGHUP.  On 7.1.X pg_hba.conf is reread
> > on every connection request.
> 
> Why was it changed ?

Performance.  Peter E found that considerable startup time was being
wasted reading the file.


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Fri, 9 Nov 2001 18:31:47 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: best method of reloading pg_hba.conf
> > Performance.  Peter E found that considerable startup time was being
> > wasted reading the file.
> 
> But can't we read it only when needed ?
> 
> Just stat'ing it should be much cheaper than reading it each time.

We thought about that but it seems we could be reading partial writes to
the file.  This way the administrator controls when the changes become
effective.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Fri, 9 Nov 2001 18:46:14 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: best method of reloading pg_hba.conf
Hannu Krosing <hannu@tm.ee> writes:

> Bruce Momjian wrote:
> > 
> > > Is the best method of reloading pg_hba.conf to SIGHUP the master process?
> > 
> > In 7.2, yes, pg_ctl restart or SIGHUP.  On 7.1.X pg_hba.conf is reread
> > on every connection request.
> 
> Why was it changed ?

I think to give the admin control over when it gets reread.  Say it's
being automatically generated by a cron job for some reason, and a
connection request comes in while it's being written--the backend
would get a corrupted version of the file.  (Or if a text editor's in
the midst of saving it).

-Doug
-- 
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

09 Nov 2001 18:50:42 -0500
Doug McNaught <doug@wireboard.com>
Re: best method of reloading pg_hba.conf
Hannu Krosing <hannu@tm.ee> writes:
> Bruce Momjian wrote:
>> In 7.2, yes, pg_ctl restart or SIGHUP.  On 7.1.X pg_hba.conf is reread
>> on every connection request.

> Why was it changed ?

To cut a few more percent off connection startup time.  (According to
Bruce's measurements, reading pg_hba.conf was a measurable fraction
of startup.)

			regards, tom lane

Fri, 09 Nov 2001 18:55:54 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: best method of reloading pg_hba.conf 
Bruce Momjian wrote:
> 
> > > Performance.  Peter E found that considerable startup time was being
> > > wasted reading the file.
> >
> > But can't we read it only when needed ?
> >
> > Just stat'ing it should be much cheaper than reading it each time.
> 
> We thought about that but it seems we could be reading partial writes to
> the file.  This way the administrator controls when the changes become
> effective.
> 

Hannu,

It is not only much safer (you get a 2nd chance to check what you've
done)
but is also consistent with the behavior of other Unix daemons.


-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

Fri, 09 Nov 2001 19:21:02 -0500
Fernando Nasser <fnasser@redhat.com>
Re: best method of reloading pg_hba.conf
>> But can't we read it only when needed ?
>> Just stat'ing it should be much cheaper than reading it each time.

We'd already created a precedent for read-on-HUP for postgresql.conf,
and no one seemed to be complaining about that.  So although this change
will doubtless annoy some existing users, I don't see a big problem
with it.  I'm happy to avoid the stat() call --- every kernel call we
can remove from the startup sequence is another small win.

			regards, tom lane

Fri, 09 Nov 2001 19:28:41 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: best method of reloading pg_hba.conf 
Fernando Nasser wrote:
> 
> Bruce Momjian wrote:
> >
> > > > Performance.  Peter E found that considerable startup time was being
> > > > wasted reading the file.
> > >
> > > But can't we read it only when needed ?
> > >
> > > Just stat'ing it should be much cheaper than reading it each time.
> >
> > We thought about that but it seems we could be reading partial writes to
> > the file.  This way the administrator controls when the changes become
> > effective.

You could do the writing in a proper way - write to temp file and then
rename.

> Hannu,
> 
> It is not only much safer (you get a 2nd chance to check what you've
> done)
> but is also consistent with the behavior of other Unix daemons.

Well, that much I already knew ;)

Except for sendmail where I must run newaliases, that is.


Sending a HUP is actually ok with me, it just came as a surprise.

----------------------
Hannu

Sat, 10 Nov 2001 18:13:19 +0500
Hannu Krosing <hannu@tm.ee>
Re: best method of reloading pg_hba.conf