mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Use Snapshot in heap access methods.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.23 1998/07/16 01:49:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.24 1998/07/27 19:37:54 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
static Pointer
|
||||
ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
|
||||
bool isindex, ScanDirection dir);
|
||||
bool isindex, ScanDirection dir, Snapshot snapshot);
|
||||
static Relation ExecOpenR(Oid relationOid, bool isindex);
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@@ -81,6 +81,7 @@ ExecOpenScanR(Oid relOid,
|
||||
ScanKey skeys,
|
||||
bool isindex,
|
||||
ScanDirection dir,
|
||||
Snapshot snapshot,
|
||||
Relation *returnRelation, /* return */
|
||||
Pointer *returnScanDesc) /* return */
|
||||
{
|
||||
@@ -99,7 +100,8 @@ ExecOpenScanR(Oid relOid,
|
||||
nkeys,
|
||||
skeys,
|
||||
isindex,
|
||||
dir);
|
||||
dir,
|
||||
snapshot);
|
||||
|
||||
if (returnRelation != NULL)
|
||||
*returnRelation = relation;
|
||||
@@ -153,7 +155,8 @@ ExecBeginScan(Relation relation,
|
||||
int nkeys,
|
||||
ScanKey skeys,
|
||||
bool isindex,
|
||||
ScanDirection dir)
|
||||
ScanDirection dir,
|
||||
Snapshot snapshot)
|
||||
{
|
||||
Pointer scanDesc;
|
||||
|
||||
@@ -178,7 +181,7 @@ ExecBeginScan(Relation relation,
|
||||
{
|
||||
scanDesc = (Pointer) heap_beginscan(relation,
|
||||
ScanDirectionIsBackward(dir),
|
||||
false,
|
||||
snapshot,
|
||||
nkeys,
|
||||
skeys);
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.50 1998/07/20 16:14:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.51 1998/07/27 19:37:55 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -124,6 +124,8 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
|
||||
palloc(queryDesc->plantree->nParamExec * sizeof(ParamExecData));
|
||||
memset(estate->es_param_exec_vals, 0, queryDesc->plantree->nParamExec * sizeof(ParamExecData));
|
||||
}
|
||||
|
||||
estate->es_snapshot = SnapshotNow;
|
||||
|
||||
result = InitPlan(queryDesc->operation,
|
||||
queryDesc->parsetree,
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.33 1998/07/20 16:14:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.34 1998/07/27 19:37:56 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -750,7 +750,7 @@ ExecOpenIndices(Oid resultRelationOid,
|
||||
*/
|
||||
indexSd = heap_beginscan(indexRd, /* scan desc */
|
||||
false, /* scan backward flag */
|
||||
false, /* see self */
|
||||
SnapshotNow, /* NOW snapshot */
|
||||
1, /* number scan keys */
|
||||
&key); /* scan keys */
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.18 1998/06/15 19:28:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.19 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -85,7 +85,8 @@ IndexNext(IndexScan *node)
|
||||
EState *estate;
|
||||
CommonScanState *scanstate;
|
||||
IndexScanState *indexstate;
|
||||
ScanDirection direction;
|
||||
ScanDirection direction;
|
||||
Snapshot snapshot;
|
||||
int indexPtr;
|
||||
IndexScanDescPtr scanDescs;
|
||||
IndexScanDesc scandesc;
|
||||
@@ -101,6 +102,7 @@ IndexNext(IndexScan *node)
|
||||
*/
|
||||
estate = node->scan.plan.state;
|
||||
direction = estate->es_direction;
|
||||
snapshot = estate->es_snapshot;
|
||||
scanstate = node->scan.scanstate;
|
||||
indexstate = node->indxstate;
|
||||
indexPtr = indexstate->iss_IndexPtr;
|
||||
@@ -122,7 +124,8 @@ IndexNext(IndexScan *node)
|
||||
*/
|
||||
while ((result = index_getnext(scandesc, direction)) != NULL)
|
||||
{
|
||||
tuple = heap_fetch(heapRelation, false, &result->heap_iptr, &buffer);
|
||||
tuple = heap_fetch(heapRelation, snapshot,
|
||||
&result->heap_iptr, &buffer);
|
||||
/* be tidy */
|
||||
pfree(result);
|
||||
|
||||
@@ -920,6 +923,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
(ScanKey) NULL, /* scan key */
|
||||
0, /* is index */
|
||||
direction, /* scan direction */
|
||||
estate->es_snapshot, /* */
|
||||
¤tRelation, /* return: rel desc */
|
||||
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
||||
|
||||
@@ -958,6 +962,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
scanKeys[i], /* scan key */
|
||||
true, /* is index */
|
||||
direction, /* scan direction */
|
||||
estate->es_snapshot,
|
||||
&(relationDescs[i]), /* return: rel desc */
|
||||
(Pointer *) &(scanDescs[i]));
|
||||
/* return: scan desc */
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.13 1998/02/26 04:31:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.14 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -139,8 +139,7 @@ ExecMaterial(Material *node)
|
||||
*/
|
||||
currentScanDesc = heap_beginscan(currentRelation, /* relation */
|
||||
ScanDirectionIsBackward(dir),
|
||||
/* bkwd flag */
|
||||
false, /* seeself */
|
||||
SnapshotSelf, /* seeself */
|
||||
0, /* num scan keys */
|
||||
NULL); /* scan keys */
|
||||
matstate->csstate.css_currentRelation = currentRelation;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.10 1998/06/15 19:28:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.11 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -181,6 +181,7 @@ InitScanRelation(SeqScan *node, EState *estate,
|
||||
NULL, /* scan key */
|
||||
0, /* is index */
|
||||
direction,/* scan direction */
|
||||
estate->es_snapshot,
|
||||
¤tRelation, /* return: rel desc */
|
||||
(Pointer *) ¤tScanDesc); /* return: scan desc */
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* ExecEndTee
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.18 1998/06/15 19:28:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.19 1998/07/27 19:37:57 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -226,10 +226,11 @@ ExecCountSlotsTee(Tee *node)
|
||||
static void
|
||||
initTeeScanDescs(Tee *node)
|
||||
{
|
||||
TeeState *teeState;
|
||||
Relation bufferRel;
|
||||
ScanDirection dir;
|
||||
MemoryContext orig;
|
||||
TeeState *teeState;
|
||||
Relation bufferRel;
|
||||
ScanDirection dir;
|
||||
Snapshot snapshot;
|
||||
MemoryContext orig;
|
||||
|
||||
teeState = node->teestate;
|
||||
if (teeState->tee_leftScanDesc && teeState->tee_rightScanDesc)
|
||||
@@ -241,23 +242,24 @@ initTeeScanDescs(Tee *node)
|
||||
bufferRel = teeState->tee_bufferRel;
|
||||
dir = ((Plan *) node)->state->es_direction; /* backwards not handled
|
||||
* yet XXX */
|
||||
snapshot = ((Plan *) node)->state->es_snapshot;
|
||||
|
||||
if (teeState->tee_leftScanDesc == NULL)
|
||||
{
|
||||
teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
|
||||
ScanDirectionIsBackward(dir),
|
||||
false, /* seeself */
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
snapshot,
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
);
|
||||
}
|
||||
if (teeState->tee_rightScanDesc == NULL)
|
||||
{
|
||||
teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
|
||||
ScanDirectionIsBackward(dir),
|
||||
false, /* seeself */
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
snapshot,
|
||||
0, /* num scan keys */
|
||||
NULL /* scan keys */
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user