PostgreSQL Source Code  git master
nodeBitmapHeapscan.h File Reference
#include "nodes/execnodes.h"
#include "access/parallel.h"
Include dependency graph for nodeBitmapHeapscan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

BitmapHeapScanStateExecInitBitmapHeapScan (BitmapHeapScan *node, EState *estate, int eflags)
 
void ExecEndBitmapHeapScan (BitmapHeapScanState *node)
 
void ExecReScanBitmapHeapScan (BitmapHeapScanState *node)
 
void ExecBitmapHeapEstimate (BitmapHeapScanState *node, ParallelContext *pcxt)
 
void ExecBitmapHeapInitializeDSM (BitmapHeapScanState *node, ParallelContext *pcxt)
 
void ExecBitmapHeapReInitializeDSM (BitmapHeapScanState *node, ParallelContext *pcxt)
 
void ExecBitmapHeapInitializeWorker (BitmapHeapScanState *node, ParallelWorkerContext *pwcxt)
 

Function Documentation

◆ ExecBitmapHeapEstimate()

void ExecBitmapHeapEstimate ( BitmapHeapScanState node,
ParallelContext pcxt 
)

Definition at line 1029 of file nodeBitmapHeapscan.c.

References add_size(), EState::es_snapshot, EstimateSnapshotSpace(), ParallelContext::estimator, offsetof, ScanState::ps, BitmapHeapScanState::pscan_len, shm_toc_estimate_chunk, shm_toc_estimate_keys, BitmapHeapScanState::ss, and PlanState::state.

Referenced by ExecParallelEstimate().

1031 {
1032  EState *estate = node->ss.ps.state;
1033 
1035  phs_snapshot_data),
1037 
1039  shm_toc_estimate_keys(&pcxt->estimator, 1);
1040 }
shm_toc_estimator estimator
Definition: parallel.h:41
Snapshot es_snapshot
Definition: execnodes.h:440
EState * state
Definition: execnodes.h:860
#define shm_toc_estimate_chunk(e, sz)
Definition: shm_toc.h:51
PlanState ps
Definition: execnodes.h:1114
Size EstimateSnapshotSpace(Snapshot snap)
Definition: snapmgr.c:2044
Size add_size(Size s1, Size s2)
Definition: shmem.c:475
#define shm_toc_estimate_keys(e, cnt)
Definition: shm_toc.h:53
#define offsetof(type, field)
Definition: c.h:603

◆ ExecBitmapHeapInitializeDSM()

void ExecBitmapHeapInitializeDSM ( BitmapHeapScanState node,
ParallelContext pcxt 
)

Definition at line 1049 of file nodeBitmapHeapscan.c.

References BM_INITIAL, ConditionVariableInit(), ParallelBitmapHeapState::cv, EState::es_query_dsa, EState::es_snapshot, ParallelBitmapHeapState::mutex, ParallelBitmapHeapState::phs_snapshot_data, PlanState::plan, Plan::plan_node_id, ParallelBitmapHeapState::prefetch_iterator, ParallelBitmapHeapState::prefetch_pages, ParallelBitmapHeapState::prefetch_target, ScanState::ps, BitmapHeapScanState::pscan_len, BitmapHeapScanState::pstate, SerializeSnapshot(), shm_toc_allocate(), shm_toc_insert(), SpinLockInit, BitmapHeapScanState::ss, PlanState::state, ParallelBitmapHeapState::state, ParallelBitmapHeapState::tbmiterator, and ParallelContext::toc.

Referenced by ExecParallelInitializeDSM().

1051 {
1052  ParallelBitmapHeapState *pstate;
1053  EState *estate = node->ss.ps.state;
1054  dsa_area *dsa = node->ss.ps.state->es_query_dsa;
1055 
1056  /* If there's no DSA, there are no workers; initialize nothing. */
1057  if (dsa == NULL)
1058  return;
1059 
1060  pstate = shm_toc_allocate(pcxt->toc, node->pscan_len);
1061 
1062  pstate->tbmiterator = 0;
1063  pstate->prefetch_iterator = 0;
1064 
1065  /* Initialize the mutex */
1066  SpinLockInit(&pstate->mutex);
1067  pstate->prefetch_pages = 0;
1068  pstate->prefetch_target = 0;
1069  pstate->state = BM_INITIAL;
1070 
1071  ConditionVariableInit(&pstate->cv);
1073 
1074  shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id, pstate);
1075  node->pstate = pstate;
1076 }
struct dsa_area * es_query_dsa
Definition: execnodes.h:524
#define SpinLockInit(lock)
Definition: spin.h:60
int plan_node_id
Definition: plannodes.h:143
Snapshot es_snapshot
Definition: execnodes.h:440
EState * state
Definition: execnodes.h:860
PlanState ps
Definition: execnodes.h:1114
void ConditionVariableInit(ConditionVariable *cv)
ParallelBitmapHeapState * pstate
Definition: execnodes.h:1383
void SerializeSnapshot(Snapshot snapshot, char *start_address)
Definition: snapmgr.c:2068
dsa_pointer tbmiterator
Definition: execnodes.h:1328
Plan * plan
Definition: execnodes.h:858
dsa_pointer prefetch_iterator
Definition: execnodes.h:1329
SharedBitmapState state
Definition: execnodes.h:1333
void * shm_toc_allocate(shm_toc *toc, Size nbytes)
Definition: shm_toc.c:88
char phs_snapshot_data[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:1335
Definition: dsa.c:354
void shm_toc_insert(shm_toc *toc, uint64 key, void *address)
Definition: shm_toc.c:171
ConditionVariable cv
Definition: execnodes.h:1334
shm_toc * toc
Definition: parallel.h:44

◆ ExecBitmapHeapInitializeWorker()

void ExecBitmapHeapInitializeWorker ( BitmapHeapScanState node,
ParallelWorkerContext pwcxt 
)

Definition at line 1114 of file nodeBitmapHeapscan.c.

References Assert, EState::es_query_dsa, heap_update_snapshot(), ParallelBitmapHeapState::phs_snapshot_data, PlanState::plan, Plan::plan_node_id, ScanState::ps, BitmapHeapScanState::pstate, RestoreSnapshot(), shm_toc_lookup(), BitmapHeapScanState::ss, ScanState::ss_currentScanDesc, PlanState::state, and ParallelWorkerContext::toc.

Referenced by ExecParallelInitializeWorker().

1116 {
1117  ParallelBitmapHeapState *pstate;
1118  Snapshot snapshot;
1119 
1120  Assert(node->ss.ps.state->es_query_dsa != NULL);
1121 
1122  pstate = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
1123  node->pstate = pstate;
1124 
1125  snapshot = RestoreSnapshot(pstate->phs_snapshot_data);
1126  heap_update_snapshot(node->ss.ss_currentScanDesc, snapshot);
1127 }
struct dsa_area * es_query_dsa
Definition: execnodes.h:524
Snapshot RestoreSnapshot(char *start_address)
Definition: snapmgr.c:2127
void heap_update_snapshot(HeapScanDesc scan, Snapshot snapshot)
Definition: heapam.c:1774
int plan_node_id
Definition: plannodes.h:143
EState * state
Definition: execnodes.h:860
PlanState ps
Definition: execnodes.h:1114
ParallelBitmapHeapState * pstate
Definition: execnodes.h:1383
Plan * plan
Definition: execnodes.h:858
#define Assert(condition)
Definition: c.h:680
char phs_snapshot_data[FLEXIBLE_ARRAY_MEMBER]
Definition: execnodes.h:1335
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1116
void * shm_toc_lookup(shm_toc *toc, uint64 key, bool noError)
Definition: shm_toc.c:232

◆ ExecBitmapHeapReInitializeDSM()

void ExecBitmapHeapReInitializeDSM ( BitmapHeapScanState node,
ParallelContext pcxt 
)

Definition at line 1085 of file nodeBitmapHeapscan.c.

References BM_INITIAL, DsaPointerIsValid, EState::es_query_dsa, InvalidDsaPointer, ParallelBitmapHeapState::prefetch_iterator, ScanState::ps, BitmapHeapScanState::pstate, BitmapHeapScanState::ss, PlanState::state, ParallelBitmapHeapState::state, tbm_free_shared_area(), and ParallelBitmapHeapState::tbmiterator.

Referenced by ExecParallelReInitializeDSM().

1087 {
1088  ParallelBitmapHeapState *pstate = node->pstate;
1089  dsa_area *dsa = node->ss.ps.state->es_query_dsa;
1090 
1091  /* If there's no DSA, there are no workers; do nothing. */
1092  if (dsa == NULL)
1093  return;
1094 
1095  pstate->state = BM_INITIAL;
1096 
1097  if (DsaPointerIsValid(pstate->tbmiterator))
1098  tbm_free_shared_area(dsa, pstate->tbmiterator);
1099 
1100  if (DsaPointerIsValid(pstate->prefetch_iterator))
1102 
1103  pstate->tbmiterator = InvalidDsaPointer;
1105 }
struct dsa_area * es_query_dsa
Definition: execnodes.h:524
#define InvalidDsaPointer
Definition: dsa.h:78
EState * state
Definition: execnodes.h:860
PlanState ps
Definition: execnodes.h:1114
ParallelBitmapHeapState * pstate
Definition: execnodes.h:1383
dsa_pointer tbmiterator
Definition: execnodes.h:1328
void tbm_free_shared_area(dsa_area *dsa, dsa_pointer dp)
Definition: tidbitmap.c:340
dsa_pointer prefetch_iterator
Definition: execnodes.h:1329
SharedBitmapState state
Definition: execnodes.h:1333
#define DsaPointerIsValid(x)
Definition: dsa.h:81
Definition: dsa.c:354

◆ ExecEndBitmapHeapScan()

void ExecEndBitmapHeapScan ( BitmapHeapScanState node)

Definition at line 792 of file nodeBitmapHeapscan.c.

References ExecClearTuple(), ExecCloseScanRelation(), ExecEndNode(), ExecFreeExprContext(), heap_endscan(), InvalidBuffer, outerPlanState, BitmapHeapScanState::prefetch_iterator, ScanState::ps, PlanState::ps_ResultTupleSlot, BitmapHeapScanState::pvmbuffer, ReleaseBuffer(), BitmapHeapScanState::shared_prefetch_iterator, BitmapHeapScanState::shared_tbmiterator, BitmapHeapScanState::ss, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, ScanState::ss_ScanTupleSlot, BitmapHeapScanState::tbm, tbm_end_iterate(), tbm_end_shared_iterate(), tbm_free(), BitmapHeapScanState::tbmiterator, and BitmapHeapScanState::vmbuffer.

Referenced by ExecEndNode().

793 {
794  Relation relation;
795  HeapScanDesc scanDesc;
796 
797  /*
798  * extract information from the node
799  */
800  relation = node->ss.ss_currentRelation;
801  scanDesc = node->ss.ss_currentScanDesc;
802 
803  /*
804  * Free the exprcontext
805  */
806  ExecFreeExprContext(&node->ss.ps);
807 
808  /*
809  * clear out tuple table slots
810  */
813 
814  /*
815  * close down subplans
816  */
818 
819  /*
820  * release bitmaps and buffers if any
821  */
822  if (node->tbmiterator)
824  if (node->prefetch_iterator)
826  if (node->tbm)
827  tbm_free(node->tbm);
828  if (node->shared_tbmiterator)
830  if (node->shared_prefetch_iterator)
832  if (node->vmbuffer != InvalidBuffer)
833  ReleaseBuffer(node->vmbuffer);
834  if (node->pvmbuffer != InvalidBuffer)
835  ReleaseBuffer(node->pvmbuffer);
836 
837  /*
838  * close heap scan
839  */
840  heap_endscan(scanDesc);
841 
842  /*
843  * close the heap relation.
844  */
845  ExecCloseScanRelation(relation);
846 }
void tbm_end_iterate(TBMIterator *iterator)
Definition: tidbitmap.c:1145
void heap_endscan(HeapScanDesc scan)
Definition: heapam.c:1565
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:539
TIDBitmap * tbm
Definition: execnodes.h:1366
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
#define InvalidBuffer
Definition: buf.h:25
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1117
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3309
Relation ss_currentRelation
Definition: execnodes.h:1115
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:603
PlanState ps
Definition: execnodes.h:1114
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:891
#define outerPlanState(node)
Definition: execnodes.h:904
void tbm_free(TIDBitmap *tbm)
Definition: tidbitmap.c:321
void ExecCloseScanRelation(Relation scanrel)
Definition: execUtils.c:748
TBMSharedIterator * shared_tbmiterator
Definition: execnodes.h:1381
TBMIterator * tbmiterator
Definition: execnodes.h:1367
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1116
TBMIterator * prefetch_iterator
Definition: execnodes.h:1375
TBMSharedIterator * shared_prefetch_iterator
Definition: execnodes.h:1382
void tbm_end_shared_iterate(TBMSharedIterator *iterator)
Definition: tidbitmap.c:1157

◆ ExecInitBitmapHeapScan()

BitmapHeapScanState* ExecInitBitmapHeapScan ( BitmapHeapScan node,
EState estate,
int  eflags 
)

Definition at line 855 of file nodeBitmapHeapscan.c.

References Assert, BitmapHeapScan::bitmapqualorig, BitmapHeapScanState::can_skip_fetch, ComputeIoConcurrency(), effective_io_concurrency, EState::es_snapshot, BitmapHeapScanState::exact_pages, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecAssignScanType(), ExecBitmapHeapScan(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), PlanState::ExecProcNode, get_tablespace_io_concurrency(), heap_beginscan_bm(), BitmapHeapScanState::initialized, InvalidBuffer, IsMVCCSnapshot, BitmapHeapScanState::lossy_pages, makeNode, NIL, outerPlan, outerPlanState, Scan::plan, PlanState::plan, BitmapHeapScanState::prefetch_iterator, BitmapHeapScanState::prefetch_maximum, BitmapHeapScanState::prefetch_pages, BitmapHeapScanState::prefetch_target, ScanState::ps, BitmapHeapScanState::pscan_len, BitmapHeapScanState::pstate, BitmapHeapScanState::pvmbuffer, Plan::qual, PlanState::qual, RelationData::rd_rel, RelationGetDescr, rint(), BitmapHeapScan::scan, Scan::scanrelid, BitmapHeapScanState::shared_prefetch_iterator, BitmapHeapScanState::shared_tbmiterator, BitmapHeapScanState::skip_fetch, BitmapHeapScanState::ss, PlanState::state, target_prefetch_pages, Plan::targetlist, BitmapHeapScanState::tbm, BitmapHeapScanState::tbmiterator, BitmapHeapScanState::tbmres, and BitmapHeapScanState::vmbuffer.

Referenced by ExecInitNode().

856 {
857  BitmapHeapScanState *scanstate;
858  Relation currentRelation;
859  int io_concurrency;
860 
861  /* check for unsupported flags */
862  Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
863 
864  /*
865  * Assert caller didn't ask for an unsafe snapshot --- see comments at
866  * head of file.
867  */
869 
870  /*
871  * create state structure
872  */
873  scanstate = makeNode(BitmapHeapScanState);
874  scanstate->ss.ps.plan = (Plan *) node;
875  scanstate->ss.ps.state = estate;
876  scanstate->ss.ps.ExecProcNode = ExecBitmapHeapScan;
877 
878  scanstate->tbm = NULL;
879  scanstate->tbmiterator = NULL;
880  scanstate->tbmres = NULL;
881  scanstate->skip_fetch = false;
882  scanstate->vmbuffer = InvalidBuffer;
883  scanstate->pvmbuffer = InvalidBuffer;
884  scanstate->exact_pages = 0;
885  scanstate->lossy_pages = 0;
886  scanstate->prefetch_iterator = NULL;
887  scanstate->prefetch_pages = 0;
888  scanstate->prefetch_target = 0;
889  /* may be updated below */
891  scanstate->pscan_len = 0;
892  scanstate->initialized = false;
893  scanstate->shared_tbmiterator = NULL;
894  scanstate->shared_prefetch_iterator = NULL;
895  scanstate->pstate = NULL;
896 
897  /*
898  * We can potentially skip fetching heap pages if we do not need any
899  * columns of the table, either for checking non-indexable quals or for
900  * returning data. This test is a bit simplistic, as it checks the
901  * stronger condition that there's no qual or return tlist at all. But in
902  * most cases it's probably not worth working harder than that.
903  */
904  scanstate->can_skip_fetch = (node->scan.plan.qual == NIL &&
905  node->scan.plan.targetlist == NIL);
906 
907  /*
908  * Miscellaneous initialization
909  *
910  * create expression context for node
911  */
912  ExecAssignExprContext(estate, &scanstate->ss.ps);
913 
914  /*
915  * initialize child expressions
916  */
917  scanstate->ss.ps.qual =
918  ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
919  scanstate->bitmapqualorig =
920  ExecInitQual(node->bitmapqualorig, (PlanState *) scanstate);
921 
922  /*
923  * tuple table initialization
924  */
925  ExecInitResultTupleSlot(estate, &scanstate->ss.ps);
926  ExecInitScanTupleSlot(estate, &scanstate->ss);
927 
928  /*
929  * open the base relation and acquire appropriate lock on it.
930  */
931  currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags);
932 
933  /*
934  * Determine the maximum for prefetch_target. If the tablespace has a
935  * specific IO concurrency set, use that to compute the corresponding
936  * maximum value; otherwise, we already initialized to the value computed
937  * by the GUC machinery.
938  */
939  io_concurrency =
940  get_tablespace_io_concurrency(currentRelation->rd_rel->reltablespace);
941  if (io_concurrency != effective_io_concurrency)
942  {
943  double maximum;
944 
945  if (ComputeIoConcurrency(io_concurrency, &maximum))
946  scanstate->prefetch_maximum = rint(maximum);
947  }
948 
949  scanstate->ss.ss_currentRelation = currentRelation;
950 
951  /*
952  * Even though we aren't going to do a conventional seqscan, it is useful
953  * to create a HeapScanDesc --- most of the fields in it are usable.
954  */
955  scanstate->ss.ss_currentScanDesc = heap_beginscan_bm(currentRelation,
956  estate->es_snapshot,
957  0,
958  NULL);
959 
960  /*
961  * get the scan type from the relation descriptor.
962  */
963  ExecAssignScanType(&scanstate->ss, RelationGetDescr(currentRelation));
964 
965  /*
966  * Initialize result tuple type and projection info.
967  */
968  ExecAssignResultTypeFromTL(&scanstate->ss.ps);
969  ExecAssignScanProjectionInfo(&scanstate->ss);
970 
971  /*
972  * initialize child nodes
973  *
974  * We do this last because the child nodes will open indexscans on our
975  * relation's indexes, and we want to be sure we have acquired a lock on
976  * the relation first.
977  */
978  outerPlanState(scanstate) = ExecInitNode(outerPlan(node), estate, eflags);
979 
980  /*
981  * all done.
982  */
983  return scanstate;
984 }
#define NIL
Definition: pg_list.h:69
List * qual
Definition: plannodes.h:145
int target_prefetch_pages
Definition: bufmgr.c:129
Plan plan
Definition: plannodes.h:329
ExprState * bitmapqualorig
Definition: execnodes.h:1365
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
Index scanrelid
Definition: plannodes.h:330
#define RelationGetDescr(relation)
Definition: rel.h:437
TIDBitmap * tbm
Definition: execnodes.h:1366
#define InvalidBuffer
Definition: buf.h:25
int get_tablespace_io_concurrency(Oid spcid)
Definition: spccache.c:215
Snapshot es_snapshot
Definition: execnodes.h:440
Relation ss_currentRelation
Definition: execnodes.h:1115
EState * state
Definition: execnodes.h:860
Form_pg_class rd_rel
Definition: rel.h:114
int effective_io_concurrency
Definition: bufmgr.c:112
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:204
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:448
bool ComputeIoConcurrency(int io_concurrency, double *target)
Definition: bufmgr.c:467
PlanState ps
Definition: execnodes.h:1114
static TupleTableSlot * ExecBitmapHeapScan(PlanState *pstate)
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:235
ParallelBitmapHeapState * pstate
Definition: execnodes.h:1383
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:690
#define EXEC_FLAG_BACKWARD
Definition: executor.h:60
#define outerPlanState(node)
Definition: execnodes.h:904
double rint(double x)
Definition: rint.c:22
List * bitmapqualorig
Definition: plannodes.h:464
TBMIterateResult * tbmres
Definition: execnodes.h:1368
#define outerPlan(node)
Definition: plannodes.h:174
HeapScanDesc heap_beginscan_bm(Relation relation, Snapshot snapshot, int nkeys, ScanKey key)
Definition: heapam.c:1425
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:864
Plan * plan
Definition: execnodes.h:858
#define makeNode(_type_)
Definition: nodes.h:560
#define Assert(condition)
Definition: c.h:680
#define IsMVCCSnapshot(snapshot)
Definition: tqual.h:31
#define EXEC_FLAG_MARK
Definition: executor.h:61
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:426
TBMSharedIterator * shared_tbmiterator
Definition: execnodes.h:1381
TBMIterator * tbmiterator
Definition: execnodes.h:1367
List * targetlist
Definition: plannodes.h:144
ExprState * qual
Definition: execnodes.h:876
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1116
TBMIterator * prefetch_iterator
Definition: execnodes.h:1375
void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc)
Definition: execUtils.c:627
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:139
TBMSharedIterator * shared_prefetch_iterator
Definition: execnodes.h:1382

◆ ExecReScanBitmapHeapScan()

void ExecReScanBitmapHeapScan ( BitmapHeapScanState node)

Definition at line 745 of file nodeBitmapHeapscan.c.

References PlanState::chgParam, ExecReScan(), ExecScanReScan(), heap_rescan(), BitmapHeapScanState::initialized, InvalidBuffer, outerPlan, outerPlanState, BitmapHeapScanState::prefetch_iterator, BitmapHeapScanState::pvmbuffer, ReleaseBuffer(), BitmapHeapScanState::shared_prefetch_iterator, BitmapHeapScanState::shared_tbmiterator, BitmapHeapScanState::ss, ScanState::ss_currentScanDesc, BitmapHeapScanState::tbm, tbm_end_iterate(), tbm_end_shared_iterate(), tbm_free(), BitmapHeapScanState::tbmiterator, BitmapHeapScanState::tbmres, and BitmapHeapScanState::vmbuffer.

Referenced by ExecReScan().

746 {
748 
749  /* rescan to release any page pin */
750  heap_rescan(node->ss.ss_currentScanDesc, NULL);
751 
752  /* release bitmaps and buffers if any */
753  if (node->tbmiterator)
755  if (node->prefetch_iterator)
757  if (node->shared_tbmiterator)
759  if (node->shared_prefetch_iterator)
761  if (node->tbm)
762  tbm_free(node->tbm);
763  if (node->vmbuffer != InvalidBuffer)
764  ReleaseBuffer(node->vmbuffer);
765  if (node->pvmbuffer != InvalidBuffer)
766  ReleaseBuffer(node->pvmbuffer);
767  node->tbm = NULL;
768  node->tbmiterator = NULL;
769  node->tbmres = NULL;
770  node->prefetch_iterator = NULL;
771  node->initialized = false;
772  node->shared_tbmiterator = NULL;
773  node->shared_prefetch_iterator = NULL;
774  node->vmbuffer = InvalidBuffer;
775  node->pvmbuffer = InvalidBuffer;
776 
777  ExecScanReScan(&node->ss);
778 
779  /*
780  * if chgParam of subnode is not null then plan will be re-scanned by
781  * first ExecProcNode.
782  */
783  if (outerPlan->chgParam == NULL)
784  ExecReScan(outerPlan);
785 }
void tbm_end_iterate(TBMIterator *iterator)
Definition: tidbitmap.c:1145
TIDBitmap * tbm
Definition: execnodes.h:1366
void ExecReScan(PlanState *node)
Definition: execAmi.c:76
#define InvalidBuffer
Definition: buf.h:25
void ReleaseBuffer(Buffer buffer)
Definition: bufmgr.c:3309
#define outerPlanState(node)
Definition: execnodes.h:904
void tbm_free(TIDBitmap *tbm)
Definition: tidbitmap.c:321
void heap_rescan(HeapScanDesc scan, ScanKey key)
Definition: heapam.c:1521
TBMIterateResult * tbmres
Definition: execnodes.h:1368
Bitmapset * chgParam
Definition: execnodes.h:886
#define outerPlan(node)
Definition: plannodes.h:174
TBMSharedIterator * shared_tbmiterator
Definition: execnodes.h:1381
TBMIterator * tbmiterator
Definition: execnodes.h:1367
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1116
TBMIterator * prefetch_iterator
Definition: execnodes.h:1375
void ExecScanReScan(ScanState *node)
Definition: execScan.c:262
TBMSharedIterator * shared_prefetch_iterator
Definition: execnodes.h:1382
void tbm_end_shared_iterate(TBMSharedIterator *iterator)
Definition: tidbitmap.c:1157