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 по дате отправления: