On 25 Aug 2002, Neil Conway wrote:
> [only replying to -patches, this doesn't belong on -hackers AFAICS ]
Is -patches for discussions? I thought it was only for the patches
themselves, I'd better go subscribe...
>
> "Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> > In addition, this limit is only checked on initialisation of a backend
> > process. So reserved slots can be taken by connections that subsequently
> > lose superuser priviledges thus evading the lower limit on backends.
>
> How can that happen?
Well, the test is located somewhere that is only called once, when the backend
process is forked. At least that's what I think but as I say I'm not 100%
certain, mostly becuase I haven't checked only looked to see what the
routine is doing and it looks like a one shot routine to me. Therefore,
assuming doing a SET SESSION AUTH... doesn't drop and then reconnect to the
server, a change from a superuser to a normaluser is not going to result in a
dropped connection. Nor should it do I believe.
>
> + /*
> + * Force ReservedBackends is less than MaxBackends if need be.
> + * A cluster only allowing superuser connections seems silly whereas
> + * a cluster reserving none for superusers doesn't.
> + */
> + if (ReservedBackends >= MaxBackends)
> + ReservedBackends = MaxBackends - 1;
>
> IMHO, we should elog(FATAL) here, or at least emit a warning.
The warning sounds reasonable to me. I'll add one and resubmit in a day or two
after I've seen what else gets said.
--
Nigel J. Andrews