Re: small parallel restore optimization

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: small parallel restore optimization
Date: 2009-03-09 00:45:43
Message-ID: 49B466B7.70207@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>> I've seen a recent error that suggests we are clobbering memory
>> somewhere in the parallel code, as well as Olivier Prennant's reported
>> error that suggests the same thing, although I'm blessed if I can see
>> where it might be. Maybe some more eyeballs on the code would help.
>>
>
> Can you put together even a weakly reproducible test case? Something
> that only fails every tenth or hundredth time would still help.
>
>
>

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.

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.

Has anyone got a better plan?

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-03-09 01:14:26 Re: postgresql.conf: patch to have ParseConfigFile report all parsing errors, then bail
Previous Message Alvaro Herrera 2009-03-09 00:21:08 Re: postgresql.conf: patch to have ParseConfigFile report all parsing errors, then bail