]> granicus.if.org Git - postgresql/commit
Fix buffer usage stats for parallel nodes.
authorAmit Kapila <akapila@postgresql.org>
Fri, 3 Aug 2018 05:32:02 +0000 (11:02 +0530)
committerAmit Kapila <akapila@postgresql.org>
Fri, 3 Aug 2018 05:32:02 +0000 (11:02 +0530)
commit85c9d3475e4f680dbca7c04fe096af018f3b8760
tree7956225de3fc9f5e79f40c7baf02a8324a14f5e2
parentccc84a956b00bdd4c162ca8951dd1ff7890cb51f
Fix buffer usage stats for parallel nodes.

The buffer usage stats is accounted only for the execution phase of the
node.  For Gather and Gather Merge nodes, such stats are accumulated at
the time of shutdown of workers which is done after execution of node due
to which we missed to account them for such nodes.  Fix it by treating
nodes as running while we shut down them.

We can also miss accounting for a Limit node when Gather or Gather Merge
is beneath it, because it can finish the execution before shutting down
such nodes.  So we allow a Limit node to shut down the resources before it
completes the execution.

In the passing fix the gather node code to allow workers to shut down as
soon as we find that all the tuples from the workers have been retrieved.
The original code use to do that, but is accidently removed by commit
01edb5c7fc.

Reported-by: Adrien Nayrat
Author: Amit Kapila and Robert Haas
Reviewed-by: Robert Haas and Andres Freund
Backpatch-through: 9.6 where this code was introduced
Discussion: https://postgr.es/m/86137f17-1dfb-42f9-7421-82fd786b04a1@anayrat.info
src/backend/executor/execProcnode.c
src/backend/executor/nodeGather.c
src/backend/executor/nodeLimit.c