PostgreSQL Source Code: src/backend/executor/nodeGather.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
32
40
41
46
47
48
49
50
51
54{
56 Plan *outerNode;
58
59
61
62
63
64
67 gatherstate->ps.state = estate;
69
74
75
76
77
78
79
81
82
83
84
88
89
90
91
92
93
94
97
98
99
100
103
104
105
106
107
109 {
112 }
113
114
115
116
119
120
121
122
123
125
126 return gatherstate;
127}
128
129
130
131
132
133
134
135
138{
142
144
145
146
147
148
149
150
152 {
155
156
157
158
159
161 {
163
164
165 if (!node->pei)
167 estate,
171 else
173 node->pei,
175
176
177
178
179
182
184
185
186
187
188
191
192
194 {
196
202 }
203 else
204 {
205
208 }
210 }
211
212
216 }
217
218
219
220
221
224
225
226
227
228
231 return NULL;
232
233
235 return slot;
236
237
238
239
242}
243
244
245
246
247
248
249
250void
252{
255}
256
257
258
259
260
261
264{
269
271 {
273
274 if (gatherstate->nreaders > 0)
275 {
277
279 {
281 fslot,
282 false);
283 return fslot;
284 }
285 }
286
288 {
290
291
293 gatherstate->pei ? gatherstate->pei->area : NULL;
296
298 return outerTupleSlot;
299
301 }
302 }
303
305}
306
307
308
309
312{
313 int nvisited = 0;
314
315 for (;;)
316 {
319 bool readerdone;
320
321
323
324
325
326
327
328
329
330
331
335
336
337
338
339
340 if (readerdone)
341 {
344 if (gatherstate->nreaders == 0)
345 {
347 return NULL;
348 }
355 continue;
356 }
357
358
359 if (tup)
360 return tup;
361
362
363
364
365
366
367
368
372
373
374 nvisited++;
375 if (nvisited >= gatherstate->nreaders)
376 {
377
378
379
380
382 return NULL;
383
384
386 WAIT_EVENT_EXECUTE_GATHER);
388 nvisited = 0;
389 }
390 }
391}
392
393
394
395
396
397
398
399static void
401{
402 if (node->pei != NULL)
404
405
409}
410
411
412
413
414
415
416
417void
419{
421
422
423 if (node->pei != NULL)
424 {
426 node->pei = NULL;
427 }
428}
429
430
431
432
433
434
435
436
437
438
439
440
441void
443{
446
447
449
450
452
453
454
455
456
457
458
459
463
464
465
466
467
468
469
470
471
472
473
476}
void LaunchParallelWorkers(ParallelContext *pcxt)
Bitmapset * bms_add_member(Bitmapset *a, int x)
void ExecReScan(PlanState *node)
void ExecParallelCleanup(ParallelExecutorInfo *pei)
void ExecParallelReinitialize(PlanState *planstate, ParallelExecutorInfo *pei, Bitmapset *sendParams)
void ExecParallelCreateReaders(ParallelExecutorInfo *pei)
ParallelExecutorInfo * ExecInitParallelPlan(PlanState *planstate, EState *estate, Bitmapset *sendParams, int nworkers, int64 tuples_needed)
void ExecParallelFinish(ParallelExecutorInfo *pei)
void ExecEndNode(PlanState *node)
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
void ExecInitResultTypeTL(PlanState *planstate)
TupleTableSlot * ExecStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
const TupleTableSlotOps TTSOpsMinimalTuple
TupleDesc ExecGetResultType(PlanState *planstate)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
void ExecConditionalAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc, int varno)
#define outerPlanState(node)
static TupleTableSlot * ExecProject(ProjectionInfo *projInfo)
#define ResetExprContext(econtext)
static TupleTableSlot * ExecProcNode(PlanState *node)
Assert(PointerIsAligned(start, uint64))
#define HeapTupleIsValid(tuple)
if(TABLE==NULL||TABLE_index==NULL)
void ResetLatch(Latch *latch)
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
void pfree(void *pointer)
#define CHECK_FOR_INTERRUPTS()
void ExecEndGather(GatherState *node)
static MinimalTuple gather_readnext(GatherState *gatherstate)
static TupleTableSlot * ExecGather(PlanState *pstate)
static void ExecShutdownGatherWorkers(GatherState *node)
void ExecShutdownGather(GatherState *node)
void ExecReScanGather(GatherState *node)
GatherState * ExecInitGather(Gather *node, EState *estate, int eflags)
static TupleTableSlot * gather_getnext(GatherState *gatherstate)
#define castNode(_type_, nodeptr)
bool parallel_leader_participation
struct dsa_area * es_query_dsa
int es_parallel_workers_to_launch
bool es_use_parallel_mode
int es_parallel_workers_launched
TupleTableSlot * ecxt_outertuple
TupleTableSlot * funnel_slot
struct ParallelExecutorInfo * pei
struct TupleQueueReader ** reader
bool need_to_scan_locally
struct TupleQueueReader ** reader
ExprContext * ps_ExprContext
ProjectionInfo * ps_ProjInfo
ExecProcNodeMtd ExecProcNode
MinimalTuple TupleQueueReaderNext(TupleQueueReader *reader, bool nowait, bool *done)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
#define WL_EXIT_ON_PM_DEATH