Re: best method of reloading pg_hba.conf

Lists: pgsql-hackers
From: Hannu Krosing <hannu(at)tm(dot)ee>
To: David Ford <david(at)blue-labs(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 19:57:00
Message-ID: 3BEC350C.23880D29@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 20:32:31
Message-ID: 3BEC3D5F.A67D6F96@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 20:43:55
Message-ID: 3BEC400B.142A985F@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


From: David Ford <david(at)blue-labs(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: best method of reloading pg_hba.conf
Date: 2001-11-09 22:03:58
Message-ID: 3BEC52CE.8070105@blue-labs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Is the best method of reloading pg_hba.conf to SIGHUP the master process?

David


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: David Ford <david(at)blue-labs(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 22:44:26
Message-ID: 200111092244.fA9MiRW27471@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 23:31:47
Message-ID: 200111092331.fA9NVla00617@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 23:46:14
Message-ID: 200111092346.fA9NkEf01637@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> > 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Doug McNaught <doug(at)wireboard(dot)com>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 23:50:42
Message-ID: m3g07nqzal.fsf@belphigor.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hannu Krosing <hannu(at)tm(dot)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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-09 23:55:54
Message-ID: 29101.1005350154@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hannu Krosing <hannu(at)tm(dot)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


From: Fernando Nasser <fnasser(at)redhat(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-10 00:21:02
Message-ID: 3BEC72EE.88155C27@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-10 00:28:41
Message-ID: 29258.1005352121@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

>> 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


From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Fernando Nasser <fnasser(at)redhat(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, David Ford <david(at)blue-labs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: best method of reloading pg_hba.conf
Date: 2001-11-10 13:13:19
Message-ID: 3BED27EF.BD6804C1@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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