Re: small parallel restore optimization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: small parallel restore optimization
Дата
Msg-id 6902.1236561560@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: small parallel restore optimization  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> I have found the source of the problem I saw. dumputils.c:fmtId() uses a 
> static PQExpBuffer which it initialises the first time it's called. This 
> gets clobbered by simultaneous calls by Windows threads.

Ugh.  But that doesn't explain the original trouble report on Unixware.

> I could just make it auto and set it up on each call, but that could 
> result in a non-trivial memory leak ... it's probably called a great 
> many times. Or I could provide a parallel version where we pass in a 
> PQExpBuffer that we create, one per thread, and is used by anything 
> called by the parallel code. That seems like a bit of a potential 
> footgun, though.

I think we should try hard to keep this localized to fmtId(), rather
than changing the callers --- the latter would be a huge readability
hit.  Is there a reasonable way to have fmtId use thread-local storage
for its PQExpBuffer pointer on Windows?
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: postgresql.conf: patch to have ParseConfigFile report all parsing errors, then bail
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: small parallel restore optimization