pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Separate reinitialization of shared parallel-scan state from Exe 2+ messages / 1 participants [nested] [flat]
* pgsql: Separate reinitialization of shared parallel-scan state from Exe @ 2017-08-30 17:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2017-08-30 17:18 UTC (permalink / raw) To: pgsql-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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/41b0dd987d44089dc48e9c70024277e253b396b7 Modified Files -------------- doc/src/sgml/custom-scan.sgml | 29 +++++++-- doc/src/sgml/fdwhandler.sgml | 43 +++++++++---- src/backend/access/heap/heapam.c | 28 ++++----- src/backend/executor/execParallel.c | 101 +++++++++++++++++++++++++----- 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/backend/executor/nodeSort.c | 17 +++++ 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/executor/nodeSort.h | 1 + src/include/foreign/fdwapi.h | 4 ++ src/include/nodes/extensible.h | 3 + 24 files changed, 328 insertions(+), 133 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Separate reinitialization of shared parallel-scan state from Exe @ 2017-08-30 17:18 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2017-08-30 17:18 UTC (permalink / raw) To: pgsql-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 ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-08-30 17:18 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-08-30 17:18 pgsql: Separate reinitialization of shared parallel-scan state from Exe Tom Lane <tgl@sss.pgh.pa.us> 2017-08-30 17:18 pgsql: Separate reinitialization of shared parallel-scan state from Exe Tom Lane <tgl@sss.pgh.pa.us>
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