Shouldn't ExecShutdownNode() be called from standard_ExecutorFinish()?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Shouldn't ExecShutdownNode() be called from standard_ExecutorFinish()?
Date: 2018-10-03 19:03:21
Message-ID: 20181003190321.6fy2hnao2c46qyps@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

There's a few cases where by the time ExecutorFinish() is called,
ExecShutdownNode() has not yet been called. As, among other reasons,
ExecShutdownNode() also collects instrumentation, I think that's
problematic.

In ExplainOnePlan() we call

/* run cleanup too */
ExecutorFinish(queryDesc);

and then print the majority of the explain data:

/* Create textual dump of plan tree */
ExplainPrintPlan(es, queryDesc);

and only then shut down the entire query:

ExecutorEnd(queryDesc);

which seems to mean that if a node hasn't yet been shut down for some
reason, we'll not have information that's normally collected in
ExecShutdownNode().

ISTM, we should have a new EState member that runs ExecShutdownNode() if
in standard_ExecutorEnd() if not already done.

Am I missing something?

Greetings,

Andres Freund

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-10-03 19:56:46 Re: Query is over 2x slower with jit=on
Previous Message Rajkumar Raghuwanshi 2018-10-03 18:58:39 pg_upgrade failed with ERROR: null relpartbound for relation 18159 error.