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

Function connect_slot

src/fe_utils/parallel_slot.c:288–309  ·  view source on GitHub ↗

* Open a new database connection using the stored connection parameters and * optionally a given dbname if not null, execute the stored initial command if * any, and associate the new connection with the given slot. */

Source from the content-addressed store, hash-verified

286 * any, and associate the new connection with the given slot.
287 */
288static void
289connect_slot(ParallelSlotArray *sa, int slotno, const char *dbname)
290{
291 const char *old_override;
292 ParallelSlot *slot = &sa->slots[slotno];
293
294 old_override = sa->cparams->override_dbname;
295 if (dbname)
296 sa->cparams->override_dbname = dbname;
297 slot->connection = connectDatabase(sa->cparams, sa->progname, sa->echo, false, true);
298 sa->cparams->override_dbname = old_override;
299
300 if (PQsocket(slot->connection) >= FD_SETSIZE)
301 {
302 pg_log_fatal("too many jobs for this platform");
303 exit(1);
304 }
305
306 /* Setup the connection using the supplied command, if any. */
307 if (sa->initcmd)
308 executeCommand(slot->connection, sa->initcmd, sa->echo);
309}
310
311/*
312 * ParallelSlotsGetIdle

Callers 1

ParallelSlotsGetIdleFunction · 0.85

Calls 3

PQsocketFunction · 0.85
connectDatabaseFunction · 0.70
executeCommandFunction · 0.70

Tested by

no test coverage detected