pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Consider parallel awareness when removing single-child Appends
Date: Tue, 25 Jan 2022 08:10:58 +0000
Message-ID: <E1nCGuo-0005nR-3N@gemulon.postgresql.org> (raw)

Consider parallel awareness when removing single-child Appends

8edd0e794 added some code to remove Append and MergeAppend nodes when they
contained a single child node.  As it turned out, this was unsafe to do
when the Append/MergeAppend was parallel_aware and the child node was not.
Removing the Append/MergeAppend, in this case, could lead to the child plan
being called multiple times by parallel workers when it was unsafe to do
so.

Here we fix this by just not removing the Append/MergeAppend when the
parallel_aware flag of the parent and child node don't match.

Reported-by: Yura Sokolov
Bug: #17335
Discussion: https://postgr.es/m/b59605fecb20ba9ea94e70ab60098c237c870628.camel%40postgrespro.ru
Backpatch-through: 12, where 8edd0e794 was first introduced

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f9a74c1498d25098606fc5c4621216d38a1cc57d

Modified Files
--------------
src/backend/optimizer/plan/setrefs.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1nCGuo-0005nR-3N@gemulon.postgresql.org>
Permalink:  ../E1nCGuo-0005nR-3N@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nCGuo-0005nR-3N@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org
  Subject: Re: pgsql: Consider parallel awareness when removing single-child Appends
  In-Reply-To: <E1nCGuo-0005nR-3N@gemulon.postgresql.org>
  References: <E1nCGuo-0005nR-3N@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox