From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: [HACKERS] TODO Done. Superuser backend slot reservations |
Date: | 2002-08-26 01:41:34 |
Message-ID: | 87znva75wx.fsf@mailbox.samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
"Nigel J. Andrews" <nandrews(at)investsystems(dot)co(dot)uk> writes:
> Reserve last few process slots for super-user if max_connections
> reached
Another minor coding suggestion:
+ /*
+ * Check a normal user hasn't connected to a superuser reserved slot.
+ * Do this here since we need the user information and that only happens
+ * after we've started bringing the shared memory online. So we wait
+ * until we've registered exit handlers and potentially shut an open
+ * transaction down for an as safety conscious rejection as possible.
+ */
+ if (!superuser() && MyBackendId > MaxBackends - ReservedBackends)
+ elog(ERROR, "Normal user limit exceeded");
This would be more efficient if you placed the superuser() test after
the BackendId test, as it is both more expensive to evaluate and more
likely to be true.
Cheers,
Neil
--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC
From | Date | Subject | |
---|---|---|---|
Next Message | Tatsuo Ishii | 2002-08-26 02:08:50 | PostgreSQL 7.2.2 and docs |
Previous Message | J. R. Nield | 2002-08-26 01:35:24 | Re: Database Caching |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-08-26 02:39:15 | pg_locks cleanup |
Previous Message | Bruce Momjian | 2002-08-26 00:41:55 | Re: [PATCHES] PostgreSQL 7.2.1 and Sun's C compiler under Solaris8 |