Re: [HACKERS] CONNECTION LIMIT and Parallel Query don't play welltogether

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: [HACKERS] CONNECTION LIMIT and Parallel Query don't play welltogether
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B539C72DA@ntex2010i.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: [HACKERS] CONNECTION LIMIT and Parallel Query don't play well together  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
Amit Kapila wrote:
> On Wed, Jan 11, 2017 at 2:44 AM, David Rowley
> <david.rowley@2ndquadrant.com> wrote:
>> It has come to my attention that when a user has a CONNECTION LIMIT
>> set, and they make use of parallel query, that their queries can fail
>> due to the connection limit being exceeded.
>>
>> Simple test case:
>>
>> postgres=# CREATE USER user1 LOGIN CONNECTION LIMIT 2;
>> [...]
>> postgres=> SELECT COUNT(*) FROM t1;
>> ERROR:  too many connections FOR ROLE "user1"
>> CONTEXT:  parallel worker
>>
>> Now, as I understand it, during the design of parallel query, it was
>> designed in such a way that nodeGather could perform all of the work
>> in the main process in the event that no workers were available, and
>> that the only user visible evidence of this would be the query would
>> be slower than it would otherwise be.
>>
>> After a little bit of looking around I see that CountUserBackends()
>> does not ignore the parallel workers, and counts these as
>> "CONNECTIONS". It's probably debatable to weather these are
>> connections or not,
> 
> I think this is not only for parallel workers, rather any background
> worker that uses database connection
> (BGWORKER_BACKEND_DATABASE_CONNECTION) will be counted in a similar
> way.  I am not sure if it is worth inventing something to consider
> such background worker connections different from backend connections.
> However, I think we should document it either in parallel query or in
> background worker or in Create User .. Connection section.

I think that this should be fixed rather than documented.
Users will not take it well if their queries error out
in this fashion.

Background processes should not be counted as active connections.
Their limit should be determined by max_worker_processes,
and neither max_connections nor the connection limit per user
or database should take them into account.

Yours,
Laurenz Albe

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: [HACKERS] Typo in dsa.c
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: [HACKERS] Proposal for changes to recovery.conf API