mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
Use Snapshot in heap access methods.
This commit is contained in:
@@ -170,7 +170,7 @@ gistbuild(Relation heap,
|
||||
econtext = NULL;
|
||||
}
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(scan, 0, &buffer);
|
||||
|
||||
/* int the tuples as we insert them */
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.18 1998/02/26 04:29:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.19 1998/07/27 19:37:35 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
@@ -121,7 +121,7 @@ hashbuild(Relation heap,
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
|
||||
/* start a heap scan */
|
||||
hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(hscan, 0, &buffer);
|
||||
|
||||
/* build the index */
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.30 1998/07/20 16:56:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.31 1998/07/27 19:37:36 vadim Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -209,7 +209,7 @@ heapgettup(Relation relation,
|
||||
ItemPointer tid,
|
||||
int dir,
|
||||
Buffer *b,
|
||||
bool seeself,
|
||||
Snapshot snapshot,
|
||||
int nkeys,
|
||||
ScanKey key)
|
||||
{
|
||||
@@ -250,9 +250,9 @@ heapgettup(Relation relation,
|
||||
}
|
||||
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", b, nkeys, key);
|
||||
|
||||
elog(DEBUG, "heapgettup: relation(%c)=`%s', %s",
|
||||
elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
|
||||
relation->rd_rel->relkind, &relation->rd_rel->relname,
|
||||
(seeself == true) ? "SeeSelf" : "NoSeeSelf");
|
||||
snapshot);
|
||||
#endif /* !defined(HEAPDEBUGALL) */
|
||||
|
||||
if (!ItemPointerIsValid(tid))
|
||||
@@ -402,7 +402,7 @@ heapgettup(Relation relation,
|
||||
* ----------------
|
||||
*/
|
||||
HeapTupleSatisfies(lpp, relation, *b, (PageHeader) dp,
|
||||
seeself, nkeys, key, rtup);
|
||||
snapshot, nkeys, key, rtup);
|
||||
if (rtup != NULL)
|
||||
{
|
||||
ItemPointer iptr = &(rtup->t_ctid);
|
||||
@@ -580,7 +580,7 @@ heap_close(Relation relation)
|
||||
HeapScanDesc
|
||||
heap_beginscan(Relation relation,
|
||||
int atend,
|
||||
bool seeself,
|
||||
Snapshot snapshot,
|
||||
unsigned nkeys,
|
||||
ScanKey key)
|
||||
{
|
||||
@@ -608,7 +608,7 @@ heap_beginscan(Relation relation,
|
||||
|
||||
/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
|
||||
if (relation->rd_rel->relkind == RELKIND_UNCATALOGED)
|
||||
seeself = true;
|
||||
snapshot = SnapshotSelf;
|
||||
|
||||
/* ----------------
|
||||
* increment relation ref count while scanning relation
|
||||
@@ -639,7 +639,7 @@ heap_beginscan(Relation relation,
|
||||
initsdesc(sdesc, relation, atend, nkeys, key);
|
||||
|
||||
sdesc->rs_atend = atend;
|
||||
sdesc->rs_seeself = seeself;
|
||||
sdesc->rs_snapshot = snapshot;
|
||||
sdesc->rs_nkeys = (short) nkeys;
|
||||
|
||||
return (sdesc);
|
||||
@@ -856,7 +856,7 @@ heap_getnext(HeapScanDesc scandesc,
|
||||
iptr,
|
||||
-1,
|
||||
&(sdesc->rs_cbuf),
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
}
|
||||
@@ -943,7 +943,7 @@ heap_getnext(HeapScanDesc scandesc,
|
||||
iptr,
|
||||
1,
|
||||
&sdesc->rs_cbuf,
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
}
|
||||
@@ -988,7 +988,7 @@ heap_getnext(HeapScanDesc scandesc,
|
||||
*/
|
||||
HeapTuple
|
||||
heap_fetch(Relation relation,
|
||||
bool seeself,
|
||||
Snapshot snapshot,
|
||||
ItemPointer tid,
|
||||
Buffer *b)
|
||||
{
|
||||
@@ -1050,7 +1050,7 @@ heap_fetch(Relation relation,
|
||||
*/
|
||||
|
||||
HeapTupleSatisfies(lp, relation, buffer, dp,
|
||||
seeself, 0, (ScanKey) NULL, tuple);
|
||||
snapshot, 0, (ScanKey) NULL, tuple);
|
||||
|
||||
if (tuple == NULL)
|
||||
{
|
||||
@@ -1447,7 +1447,7 @@ heap_markpos(HeapScanDesc sdesc)
|
||||
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
||||
-1,
|
||||
&sdesc->rs_pbuf,
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
|
||||
@@ -1461,7 +1461,7 @@ heap_markpos(HeapScanDesc sdesc)
|
||||
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
|
||||
1,
|
||||
&sdesc->rs_nbuf,
|
||||
sdesc->rs_seeself,
|
||||
sdesc->rs_snapshot,
|
||||
sdesc->rs_nkeys,
|
||||
sdesc->rs_key);
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.20 1998/06/15 19:27:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.21 1998/07/27 19:37:37 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -501,7 +501,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(operatorObjectId));
|
||||
|
||||
scan = heap_beginscan(operatorRelation, false, false,
|
||||
scan = heap_beginscan(operatorRelation, false, SnapshotNow,
|
||||
1, &scanKeyData);
|
||||
|
||||
tuple = heap_getnext(scan, false, (Buffer *) NULL);
|
||||
@@ -558,7 +558,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
ObjectIdGetDatum(indexObjectId));
|
||||
|
||||
relation = heap_openr(IndexRelationName);
|
||||
scan = heap_beginscan(relation, false, false, 1, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 1, entry);
|
||||
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "IndexSupportInitialize: corrupted catalogs");
|
||||
@@ -618,7 +618,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
entry[1].sk_argument =
|
||||
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
|
||||
|
||||
scan = heap_beginscan(relation, false, false, 2, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
|
||||
|
||||
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||
HeapTupleIsValid(tuple))
|
||||
@@ -661,7 +661,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
for (strategy = 1; strategy <= maxStrategyNumber; strategy++)
|
||||
ScanKeyEntrySetIllegal(StrategyMapGetScanKeyEntry(map, strategy));
|
||||
|
||||
scan = heap_beginscan(relation, false, false, 2, entry);
|
||||
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
|
||||
|
||||
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
|
||||
HeapTupleIsValid(tuple))
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.26 1998/06/15 19:27:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.27 1998/07/27 19:37:39 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -120,7 +120,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
|
||||
{ /* they're equal */
|
||||
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
|
||||
itup = &(btitem->bti_itup);
|
||||
htup = heap_fetch(heapRel, true, &(itup->t_tid), NULL);
|
||||
htup = heap_fetch(heapRel, SnapshotSelf, &(itup->t_tid), NULL);
|
||||
if (htup != (HeapTuple) NULL)
|
||||
{ /* it is a duplicate */
|
||||
elog(ERROR, "Cannot insert a duplicate key into a unique index");
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.26 1998/06/15 19:27:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.27 1998/07/27 19:37:40 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
@@ -153,7 +153,7 @@ btbuild(Relation heap,
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
|
||||
/* start a heap scan */
|
||||
hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(hscan, 0, &buffer);
|
||||
|
||||
/* build the index */
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.24 1998/06/15 19:28:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.25 1998/07/27 19:37:41 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -164,7 +164,7 @@ rtbuild(Relation heap,
|
||||
slot = NULL;
|
||||
}
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
|
||||
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
htup = heap_getnext(scan, 0, &buffer);
|
||||
|
||||
/* count the tuples as we insert them */
|
||||
|
Reference in New Issue
Block a user