From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Separate reinitialization of shared parallel-scan state from Exe
Date: Wed, 30 Aug 2017 17:18:30 +0000
Message-ID: <E1dn6dK-0000BJ-6l@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Separate reinitialization of shared parallel-scan state from ExecReScan.
Previously, the parallel executor logic did reinitialization of shared
state within the ExecReScan code for parallel-aware scan nodes. This is
problematic, because it means that the ExecReScan call has to occur
synchronously (ie, during the parent Gather node's ReScan call). That is
swimming very much against the tide so far as the ExecReScan machinery is
concerned; the fact that it works at all today depends on a lot of fragile
assumptions, such as that no plan node between Gather and a parallel-aware
scan node is parameterized. Another objection is that because ExecReScan
might be called in workers as well as the leader, hacky extra tests are
needed in some places to prevent unwanted shared-state resets.
Hence, let's separate this code into two functions, a ReInitializeDSM
call and the ReScan call proper. ReInitializeDSM is called only in
the leader and is guaranteed to run before we start new workers.
ReScan is returned to its traditional function of resetting only local
state, which means that ExecReScan's usual habits of delaying or
eliminating child rescan calls are safe again.
As with the preceding commit 7df2c1f8d, it doesn't seem to be necessary
to make these changes in 9.6, which is a good thing because the FDW and
CustomScan APIs are impacted.
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/d6a149f4e6a1243ccae6e1817050da9e84050b2a
Modified Files
--------------
doc/src/sgml/custom-scan.sgml | 29 ++++++++---
doc/src/sgml/fdwhandler.sgml | 43 +++++++++++-----
src/backend/access/heap/heapam.c | 38 +++++++-------
src/backend/executor/execParallel.c | 85 ++++++++++++++++++++++++++-----
src/backend/executor/nodeBitmapHeapscan.c | 42 ++++++++-------
src/backend/executor/nodeCustom.c | 15 ++++++
src/backend/executor/nodeForeignscan.c | 23 ++++++++-
src/backend/executor/nodeGather.c | 29 ++++++-----
src/backend/executor/nodeGatherMerge.c | 29 ++++++-----
src/backend/executor/nodeIndexonlyscan.c | 29 +++++------
src/backend/executor/nodeIndexscan.c | 38 ++++++--------
src/backend/executor/nodeSeqscan.c | 16 ++++++
src/include/access/heapam.h | 1 +
src/include/executor/execParallel.h | 3 +-
src/include/executor/nodeBitmapHeapscan.h | 2 +
src/include/executor/nodeCustom.h | 2 +
src/include/executor/nodeForeignscan.h | 2 +
src/include/executor/nodeIndexonlyscan.h | 2 +
src/include/executor/nodeIndexscan.h | 1 +
src/include/executor/nodeSeqscan.h | 1 +
src/include/foreign/fdwapi.h | 4 ++
src/include/nodes/extensible.h | 3 ++
22 files changed, 302 insertions(+), 135 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Separate reinitialization of shared parallel-scan state from Exe
In-Reply-To: <E1dn6dK-0000BJ-6l@gemulon.postgresql.org>
References: <E1dn6dK-0000BJ-6l@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