MCPcopy Create free account
hub / github.com/apache/cloudberry / LookupParallelWorkerFunction

Function LookupParallelWorkerFunction

src/backend/access/transam/parallel.c:1628–1652  ·  view source on GitHub ↗

* Look up (and possibly load) a parallel worker entry point function. * * For functions contained in the core code, we use library name "postgres" * and consult the InternalParallelWorkers array. External functions are * looked up, and loaded if necessary, using load_external_function(). * * The point of this is to pass function names as strings across process * boundaries. We can't pass

Source from the content-addressed store, hash-verified

1626 * but that raises portability issues that are not worth addressing now.
1627 */
1628static parallel_worker_main_type
1629LookupParallelWorkerFunction(const char *libraryname, const char *funcname)
1630{
1631 /*
1632 * If the function is to be loaded from postgres itself, search the
1633 * InternalParallelWorkers array.
1634 */
1635 if (strcmp(libraryname, "postgres") == 0)
1636 {
1637 int i;
1638
1639 for (i = 0; i < lengthof(InternalParallelWorkers); i++)
1640 {
1641 if (strcmp(InternalParallelWorkers[i].fn_name, funcname) == 0)
1642 return InternalParallelWorkers[i].fn_addr;
1643 }
1644
1645 /* We can only reach this by programming error. */
1646 elog(ERROR, "internal function \"%s\" not found", funcname);
1647 }
1648
1649 /* Otherwise load from external library. */
1650 return (parallel_worker_main_type)
1651 load_external_function(libraryname, funcname, true, NULL);
1652}
1653
1654void
1655InitGpParallelDSMHash(void)

Callers 1

ParallelWorkerMainFunction · 0.85

Calls 1

load_external_functionFunction · 0.85

Tested by

no test coverage detected