Re: ATTACH/DETACH PARTITION CONCURRENTLY - Mailing list pgsql-hackers

From David Rowley
Subject Re: ATTACH/DETACH PARTITION CONCURRENTLY
Date
Msg-id CAKJS1f8G8cB57TD6C0RBEFL7tP97QBR59=8pOvPOjoFCmG7XHQ@mail.gmail.com
Whole thread Raw
In response to Re: ATTACH/DETACH PARTITION CONCURRENTLY  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Tue, 5 Feb 2019 at 01:54, Robert Haas <robertmhaas@gmail.com> wrote:
>
> On Mon, Feb 4, 2019 at 12:02 AM David Rowley
> <david.rowley@2ndquadrant.com> wrote:
> > If the PartitionDesc from the parallel worker has an extra partition
> > than what was there when the plan was built then the partition index
> > to subplan index translation will be incorrect as the
> > find_matching_subplans_recurse() will call get_matching_partitions()
> > using the context with the PartitionDesc containing the additional
> > partition. The return value from get_matching_partitions() is fine,
> > it's just that the code inside the while ((i =
> > bms_next_member(partset, i)) >= 0) loop that will do the wrong thing.
> > It could even crash if partset has an index out of bounds of the
> > subplan_map or subpart_map arrays.
>
> Is there any chance you've missed the fact that in one of the later
> patches in the series I added code to adjust the subplan_map and
> subpart_map arrays to compensate for any extra partitions?

I admit that I hadn't looked at the patch, I was just going on what I
had read here.   I wasn't sure how the re-map would have been done as
some of the information is unavailable during execution, but I see now
that you're modified it so we send a list of Oids that we expect and
remap based on if an unexpected Oid is found.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: Jerry Sievers
Date:
Subject: Re: [patch] Add schema total size to psql \dn+
Next
From: Tom Lane
Date:
Subject: Re: proposal: variadic argument support for least, greatest function