Understanding ExecShutdownNode() - Mailing list pgsql-hackers

From David Geier
Subject Understanding ExecShutdownNode()
Date
Msg-id df6f85fe-aaee-48b9-8c85-9fb28fa2b021@gmail.com
Whole thread Raw
List pgsql-hackers
Hi hackers,

I'm working on a CSP and started wondering about the semantics of
ExecShutdownNode(). The documentation suggests that it can be used for
freeing resources early. Early meaning as soon as it's known that no
more rows need to be produced. For that, ExecutePlan() calls
ExecShutdownNode(), once all tuples got produced and no backscan is
possible.

However, reading through the code it seems to me that the function got
introduced for the purpose of being able to cleanup resources before the
DSM segment is removed. I cannot see how it could safely be used for
other purposes: ExecutePlan() calls ExecShutdownNode() even though
ExecutePlan() is possibly called again, e.g. when a cursor is used.

It looks like the existing code only works because parallelism is
disabled for all cases where ExecutePlan() might be invoked multiple
times (e.g. user cursors).

Can someone please shed some light on the intended use case? I'm
planning to conserve any learnings from this thread in src/executor/README.

--
David Geier



pgsql-hackers by date:

Previous
From: Fabrice Chapuis
Date:
Subject: incremental backup
Next
From: Etsuro Fujita
Date:
Subject: Obsolete comments in ResultRelInfo struct