Re: [HACKERS] TODO Done. Superuser backend slot reservations

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: [HACKERS] TODO Done. Superuser backend slot reservations
Дата
Msg-id 87znva75wx.fsf@mailbox.samurai.com
обсуждение исходный текст
Список pgsql-patches
"Nigel J. Andrews" <nandrews@investsystems.co.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@samurai.com> || PGP Key ID: DB3C29FC

В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [ODBC] PostgreSQL 7.2.1 and Sun's C compiler under Solaris8
Следующее
От: Neil Conway
Дата:
Сообщение: pg_locks cleanup