Bugs in superuser_reserved_connections and max_wal_senders vs max_connections

Started by Magnus Haganderover 13 years ago3 messages
#1Magnus Hagander
magnus@hagander.net

Both superuser_reserved_connections and max_wal_senders can be set to
a value that's higher than max_connections, which is quite pointless,
and annoying :)

The docs for superuser_reserved_connections say "The value must be
less than the value of max_connections.", but this is never enforced.
Well, it's strangely enfocred. With max_connections=100, I can set
superuser_reserved_connections to 103. Looks like this is caused by
autovacuum_max_workers - because if I increase that one to 4, then I
can get it up to104...

The check in PostmasterMain():
if (ReservedBackends >= MaxBackends)
{
write_stderr("%s: superuser_reserved_connections must be less than
max_connections\n", progname);
ExitPostmaster(1);
}

should probably check against MaxConnections instead of MaxBackends, I think?

The docs for max_wal_senders say nothing at all about the relation to
max_connections, which it really should. And it should probably be
enforced the same way that superuser_reserved_connections is, so you
can't set it to silly high values.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: Bugs in superuser_reserved_connections and max_wal_senders vs max_connections

Magnus Hagander <magnus@hagander.net> writes:

The check in PostmasterMain():
if (ReservedBackends >= MaxBackends)
{
write_stderr("%s: superuser_reserved_connections must be less than
max_connections\n", progname);
ExitPostmaster(1);
}

should probably check against MaxConnections instead of MaxBackends, I think?

Yeah, this code probably dates from before there was a difference.

In general, I'd bet that this is not the only place where the wrong one
of those variables is being consulted.

regards, tom lane

#3Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#2)
Re: Bugs in superuser_reserved_connections and max_wal_senders vs max_connections

On Thu, Aug 9, 2012 at 4:17 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Magnus Hagander <magnus@hagander.net> writes:

The check in PostmasterMain():
if (ReservedBackends >= MaxBackends)
{
write_stderr("%s: superuser_reserved_connections must be less than
max_connections\n", progname);
ExitPostmaster(1);
}

should probably check against MaxConnections instead of MaxBackends, I think?

Yeah, this code probably dates from before there was a difference.

That was my guess as well.

In general, I'd bet that this is not the only place where the wrong one
of those variables is being consulted.

Probably :)

I've fixed this issue. Didn't spot another one with a quick check, but
there's quite possibly something hiding somewhere, yes :)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/