Re: [sqlsmith] Failed assertion in parallel worker (ExecInitSubPlan)

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andreas Seltenreich <seltenreich(at)gmx(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [sqlsmith] Failed assertion in parallel worker (ExecInitSubPlan)
Date: 2016-06-06 10:07:33
Message-ID: CAA4eK1J6tiSNtJuOB9vxNSumi9zFJaNtb4W2=7PH9vrSZHMP=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jun 4, 2016 at 1:53 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Thu, May 12, 2016 at 2:07 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> Err, wow. That makes my head hurt. Can you explain why this case
> >> only arises for appendrel children, and not for plain rels?
> >
> > Well, plain rels only output Vars ;-)
>
> Hmm. Dilip's example in
>
https://www.postgresql.org/message-id/CAFiTN-vzg5BkK6kAh3OMhvgRu-uJvkjz47ybtopMAfGJp=zWqA@mail.gmail.com
> seems to show that it's possible to end up with a targetlist
> containing non-Vars even for a baserel. In that example,
> pull_up_subqueries() injects t2 into the parent query with a target
> list containing two items, one of which is a PlaceHolderVar
> referencing the subplan for t3.
>
> Unfortunately, that makes it a bit hard to avoid wasting cycles here.
> Amit's patch in
>
https://www.postgresql.org/message-id/CAA4eK1L-Uo=s4=0jvvVA51pj06u5WdDvSQg673yuxJ_Ja+x86Q@mail.gmail.com
> is a bit brute force: it just checks the target list for every
> relation for parallel-restricted constructs. In most cases, no
> subqueries having been pulled up, it will find none, but it'll still
> have to walk the whole target list to figure that out. If we had some
> way of knowing that nothing was pulled up into the current rel, we
> could avoid that. This seems to apply equally to baserels and
> appendrels;
>

That seems doable, as for such rels we can only have Vars and
PlaceHolderVars in targetlist. Basically, whenever we are adding
PlaceHolderVars to a relation, just remember that information and use it
later. The patch doing the same is attached with this mail. Now still,
this won't cover the case of ChildRels for an Append Relation as for that
we adjust target list separately in set_append_rel_size. I think we need
to deal with it separately.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
prohibit_parallel_clause_below_rel_v2.patch application/octet-stream 5.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2016-06-06 10:22:34 Re: Reviewing freeze map code
Previous Message Kyotaro HORIGUCHI 2016-06-06 10:07:21 Re: Parallel pg_dump's error reporting doesn't work worth squat