Re: Explain buffers wrong counter with parallel plans

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, "Jonathan S. Katz" <jonathan.katz@excoventures.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Adrien Nayrat <adrien.nayrat@anayrat.info>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2018-08-02T03:08:47Z
Lists: pgsql-hackers
Hi,

On 2018-08-02 08:21:58 +0530, Amit Kapila wrote:
> I think something on the lines what Tom and you are suggesting can be
> done with the help of EXEC_FLAG_BACKWARD, but I don't see the need to
> do anything for this patch.  The change in nodeLimit.c is any way for
> forward scans, so there shouldn't be any need for any other check.

I think this is almost a guarantee to introduce bugs in the future. And
besides that, as Robert points out, it's essentially an exiting bug for
custom scans.  Given that EXEC_FLAG_BACKWARD already exists, why not do
the right thing here?

Greetings,

Andres Freund


Commits

  1. Adjust comment atop ExecShutdownNode.

  2. Prohibit shutting down resources if there is a possibility of back up.

  3. Fix buffer usage stats for parallel nodes.

  4. Match the buffer usage tracking for leader and worker backends.

  5. Improve division of labor between execParallel.c and nodeGather[Merge].c.