Re: [HACKERS] [sqlsmith] ERROR: badly formatted node string "RESTRICTINFO... - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [HACKERS] [sqlsmith] ERROR: badly formatted node string "RESTRICTINFO...
Date
Msg-id CAA4eK1JnorHn3xBqwX408NVS2KCKyxuzuEqS+Dsgw_LXS8wHgw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] [sqlsmith] ERROR: badly formatted node string "RESTRICTINFO...  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] [sqlsmith] ERROR: badly formatted node string "RESTRICTINFO...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Apr 11, 2017 at 5:29 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> (BTW, I've not yet looked to see if this needs to be back-ported.)
>
> postgres_fdw will definitely include RestrictInfos in its fdw_private
> list in 9.6.  However, I've been unable to provoke a visible failure.
> After some rooting around, the reason seems to be that:
>
> 1. postgres_fdw doesn't mark its plans as parallel-safe --- it doesn't
> even have a IsForeignScanParallelSafe method.  So you'd think that one
> of its plans could never be transmitted to a parallel worker ... but:
>
> 2. Andreas' test query doesn't have the foreign scan in the main query
> tree, it's in an InitPlan.  9.6 did not transmit any subplans or initplans
> to parallel workers, but HEAD does.  So HEAD sends the illegal structure
> to the worker which spits up on trying to read a RestrictInfo.
>
> I think the fact that we see this problem at all may indicate an
> oversight in commit 5e6d8d2bbbcace304450b309e79366c0da4063e4 ("Allow
> parallel workers to execute subplans").  If the worker were to actually
> run the initplan, bad things would happen (the worker would create its
> own remote connection, which we don't want).  Now, in the problem plan
> the InitPlan is actually attached to the topmost Gather, which I think
> is safe because it'll be run by the master, but I wonder if we're being
> careful enough about non-parallel-safe plans for initplans/subplans.
>

Initplans are never marked parallel safe, only subplans that are
generated for parallel safe paths are marked as parallel safe.


> Also, even if the worker never actually executes the plan node, just
> doing ExecInitNode on it in a parallel worker might be more than a
> non-parallel-safe FDW is prepared to cope with.
>

I think there is a possibility of doing ExecInitNode in a parallel
worker for a parallel-unsafe subplan, because we pass a list of all
the sublans stored in planned statement.  However, the worker will
never execute such a plan as we don't generate a plan where unsafe
sublan/initplan is referenced in the node passed to the worker.  If we
want to avoid passing parallel-unsafe subplans to workers, then I
think we can maintain a list of parallel safe subplans along with
subplans in PlannerGlobal and PlannedStmt or maybe keep a parallel
safe flag in Plan so that we can pass only parallel safe plans to
workers.


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



pgsql-hackers by date:

Previous
From: Osahon Oduware
Date:
Subject: [HACKERS] Build PostGIS In Windows Using --with-gdalconfig=FILE
Next
From: Ashutosh Bapat
Date:
Subject: Re: [HACKERS] [sqlsmith] ERROR: badly formatted node string "RESTRICTINFO...