1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Allow custom and foreign scans to have shutdown callbacks.

This is expected to be useful mostly when performing such scans in
parallel, because in that case it allows (in combination with commit
acf555bc53) nodes below a Gather to get
control just before the DSM segment goes away.

KaiGai Kohei, except that I rewrote the documentation.  Reviewed by
Claudio Freire.

Discussion: http://postgr.es/m/CADyhKSXJK0jUJ8rWv4AmKDhsUh124_rEn39eqgfC5D8fu6xVuw@mail.gmail.com
This commit is contained in:
Robert Haas
2017-02-26 13:36:49 +05:30
parent 285ca26132
commit a315b967cc
9 changed files with 63 additions and 0 deletions

View File

@ -353,3 +353,19 @@ ExecForeignScanInitializeWorker(ForeignScanState *node, shm_toc *toc)
fdwroutine->InitializeWorkerForeignScan(node, toc, coordinate);
}
}
/* ----------------------------------------------------------------
* ExecShutdownForeignScan
*
* Gives FDW chance to stop asynchronous resource consumption
* and release any resources still held.
* ----------------------------------------------------------------
*/
void
ExecShutdownForeignScan(ForeignScanState *node)
{
FdwRoutine *fdwroutine = node->fdwroutine;
if (fdwroutine->ShutdownForeignScan)
fdwroutine->ShutdownForeignScan(node);
}