Re: pgsql: Add support for coordinating record typmods among parallel worke

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Add support for coordinating record typmods among parallel worke
Date: 2017-09-15 19:07:14
Message-ID: 31856.1505502434@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2017-09-15 10:33:37 -0400, Tom Lane wrote:
>> I don't much like your proposed comment; the only way that this code
>> is even approximately correct is if we're exiting the process and
>> will never touch the RecordCacheArray again. (Otherwise, it risks
>> reassigning a previously used local typmod.)

> How'd it reuse it after running the detach hook in workers?

Resetting NextRecordTypmod to zero means that we could reuse a typmod
that was previously used. Maybe that's safe because no memory of the
old record definition exists anywhere else in the process, but I'm
not exactly convinced of that. For that matter, I'm not exactly
convinced that nothing else is holding on to an actual pointer to the
record tupdesc, making it moot whether or not we flush typcache.c's
pointer. (I'm pretty sure that plpgsql, for one, might hold onto
tupdesc pointers it gets from the typcache. That's why they have
refcounts in the first place.) There's never previously been any
expectation that record typmod registrations weren't good for the life
of the process, so I don't trust any of the assumptions this code
wants to make.

It's moot as long as we're not reusing workers, anyway: nothing is
going to touch any of the record-tupdesc data before process exit.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-09-15 19:16:16 Re: pgsql: Add support for coordinating record typmods among parallel worke
Previous Message Peter Eisentraut 2017-09-15 18:29:52 pgsql: Apply pg_get_serial_sequence() to identity column sequences as w

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-09-15 19:16:16 Re: pgsql: Add support for coordinating record typmods among parallel worke
Previous Message Robert Haas 2017-09-15 19:04:35 Re: path toward faster partition pruning