*/
CHECK_FOR_INTERRUPTS();
- for (i = 0; i < pcxt->nworkers; ++i)
+ for (i = 0; i < pcxt->nworkers_launched; ++i)
{
if (pcxt->worker[i].error_mqh != NULL)
{
int i;
/* Wait until the workers actually die. */
- for (i = 0; i < pcxt->nworkers; ++i)
+ for (i = 0; i < pcxt->nworkers_launched; ++i)
{
BgwHandleStatus status;
/* Kill each worker in turn, and forget their error queues. */
if (pcxt->worker != NULL)
{
- for (i = 0; i < pcxt->nworkers; ++i)
+ for (i = 0; i < pcxt->nworkers_launched; ++i)
{
if (pcxt->worker[i].error_mqh != NULL)
{
if (pcxt->worker == NULL)
continue;
- for (i = 0; i < pcxt->nworkers; ++i)
+ for (i = 0; i < pcxt->nworkers_launched; ++i)
{
/*
* Read as many messages as we can from each worker, but stop when
WaitForParallelWorkersToFinish(pei->pcxt);
/* Next, accumulate buffer usage. */
- for (i = 0; i < pei->pcxt->nworkers; ++i)
+ for (i = 0; i < pei->pcxt->nworkers_launched; ++i)
InstrAccumParallelQuery(&pei->buffer_usage[i]);
/* Finally, accumulate instrumentation, if any. */
if (gather->num_workers > 0 && IsInParallelMode())
{
ParallelContext *pcxt;
- bool got_any_worker = false;
/* Initialize the workers required to execute Gather node. */
if (!node->pei)
LaunchParallelWorkers(pcxt);
/* Set up tuple queue readers to read the results. */
- if (pcxt->nworkers > 0)
+ if (pcxt->nworkers_launched > 0)
{
node->nreaders = 0;
node->reader =
- palloc(pcxt->nworkers * sizeof(TupleQueueReader *));
+ palloc(pcxt->nworkers_launched * sizeof(TupleQueueReader *));
- for (i = 0; i < pcxt->nworkers; ++i)
+ for (i = 0; i < pcxt->nworkers_launched; ++i)
{
- if (pcxt->worker[i].bgwhandle == NULL)
- continue;
-
shm_mq_set_handle(node->pei->tqueue[i],
pcxt->worker[i].bgwhandle);
node->reader[node->nreaders++] =
CreateTupleQueueReader(node->pei->tqueue[i],
fslot->tts_tupleDescriptor);
- got_any_worker = true;
}
}
-
- /* No workers? Then never mind. */
- if (!got_any_worker)
+ else
+ {
+ /* No workers? Then never mind. */
ExecShutdownGatherWorkers(node);
+ }
}
/* Run plan locally if no workers or not single-copy. */