Skip to content

Commit be8300b

Browse files
committed
Use Snapshot in heap access methods.
1 parent f7f989c commit be8300b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+352
-339
lines changed

src/backend/access/gist/gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ gistbuild(Relation heap,
170170
econtext = NULL;
171171
}
172172
#endif /* OMIT_PARTIAL_INDEX */
173-
scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
173+
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
174174
htup = heap_getnext(scan, 0, &buffer);
175175

176176
/* int the tuples as we insert them */

src/backend/access/hash/hash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.18 1998/02/26 04:29:28 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.19 1998/07/27 19:37:35 vadim Exp $
1111
*
1212
* NOTES
1313
* This file contains only the public interface routines.
@@ -121,7 +121,7 @@ hashbuild(Relation heap,
121121
#endif /* OMIT_PARTIAL_INDEX */
122122

123123
/* start a heap scan */
124-
hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
124+
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
125125
htup = heap_getnext(hscan, 0, &buffer);
126126

127127
/* build the index */

src/backend/access/heap/heapam.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.30 1998/07/20 16:56:53 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.31 1998/07/27 19:37:36 vadim Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -209,7 +209,7 @@ heapgettup(Relation relation,
209209
ItemPointer tid,
210210
int dir,
211211
Buffer *b,
212-
bool seeself,
212+
Snapshot snapshot,
213213
int nkeys,
214214
ScanKey key)
215215
{
@@ -250,9 +250,9 @@ heapgettup(Relation relation,
250250
}
251251
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", b, nkeys, key);
252252

253-
elog(DEBUG, "heapgettup: relation(%c)=`%s', %s",
253+
elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
254254
relation->rd_rel->relkind, &relation->rd_rel->relname,
255-
(seeself == true) ? "SeeSelf" : "NoSeeSelf");
255+
snapshot);
256256
#endif /* !defined(HEAPDEBUGALL) */
257257

258258
if (!ItemPointerIsValid(tid))
@@ -402,7 +402,7 @@ heapgettup(Relation relation,
402402
* ----------------
403403
*/
404404
HeapTupleSatisfies(lpp, relation, *b, (PageHeader) dp,
405-
seeself, nkeys, key, rtup);
405+
snapshot, nkeys, key, rtup);
406406
if (rtup != NULL)
407407
{
408408
ItemPointer iptr = &(rtup->t_ctid);
@@ -580,7 +580,7 @@ heap_close(Relation relation)
580580
HeapScanDesc
581581
heap_beginscan(Relation relation,
582582
int atend,
583-
bool seeself,
583+
Snapshot snapshot,
584584
unsigned nkeys,
585585
ScanKey key)
586586
{
@@ -608,7 +608,7 @@ heap_beginscan(Relation relation,
608608

609609
/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
610610
if (relation->rd_rel->relkind == RELKIND_UNCATALOGED)
611-
seeself = true;
611+
snapshot = SnapshotSelf;
612612

613613
/* ----------------
614614
* increment relation ref count while scanning relation
@@ -639,7 +639,7 @@ heap_beginscan(Relation relation,
639639
initsdesc(sdesc, relation, atend, nkeys, key);
640640

641641
sdesc->rs_atend = atend;
642-
sdesc->rs_seeself = seeself;
642+
sdesc->rs_snapshot = snapshot;
643643
sdesc->rs_nkeys = (short) nkeys;
644644

645645
return (sdesc);
@@ -856,7 +856,7 @@ heap_getnext(HeapScanDesc scandesc,
856856
iptr,
857857
-1,
858858
&(sdesc->rs_cbuf),
859-
sdesc->rs_seeself,
859+
sdesc->rs_snapshot,
860860
sdesc->rs_nkeys,
861861
sdesc->rs_key);
862862
}
@@ -943,7 +943,7 @@ heap_getnext(HeapScanDesc scandesc,
943943
iptr,
944944
1,
945945
&sdesc->rs_cbuf,
946-
sdesc->rs_seeself,
946+
sdesc->rs_snapshot,
947947
sdesc->rs_nkeys,
948948
sdesc->rs_key);
949949
}
@@ -988,7 +988,7 @@ heap_getnext(HeapScanDesc scandesc,
988988
*/
989989
HeapTuple
990990
heap_fetch(Relation relation,
991-
bool seeself,
991+
Snapshot snapshot,
992992
ItemPointer tid,
993993
Buffer *b)
994994
{
@@ -1050,7 +1050,7 @@ heap_fetch(Relation relation,
10501050
*/
10511051

10521052
HeapTupleSatisfies(lp, relation, buffer, dp,
1053-
seeself, 0, (ScanKey) NULL, tuple);
1053+
snapshot, 0, (ScanKey) NULL, tuple);
10541054

10551055
if (tuple == NULL)
10561056
{
@@ -1447,7 +1447,7 @@ heap_markpos(HeapScanDesc sdesc)
14471447
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
14481448
-1,
14491449
&sdesc->rs_pbuf,
1450-
sdesc->rs_seeself,
1450+
sdesc->rs_snapshot,
14511451
sdesc->rs_nkeys,
14521452
sdesc->rs_key);
14531453

@@ -1461,7 +1461,7 @@ heap_markpos(HeapScanDesc sdesc)
14611461
(ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
14621462
1,
14631463
&sdesc->rs_nbuf,
1464-
sdesc->rs_seeself,
1464+
sdesc->rs_snapshot,
14651465
sdesc->rs_nkeys,
14661466
sdesc->rs_key);
14671467
}

src/backend/access/index/istrat.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.20 1998/06/15 19:27:54 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.21 1998/07/27 19:37:37 vadim Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -501,7 +501,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
501501
F_OIDEQ,
502502
ObjectIdGetDatum(operatorObjectId));
503503

504-
scan = heap_beginscan(operatorRelation, false, false,
504+
scan = heap_beginscan(operatorRelation, false, SnapshotNow,
505505
1, &scanKeyData);
506506

507507
tuple = heap_getnext(scan, false, (Buffer *) NULL);
@@ -558,7 +558,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
558558
ObjectIdGetDatum(indexObjectId));
559559

560560
relation = heap_openr(IndexRelationName);
561-
scan = heap_beginscan(relation, false, false, 1, entry);
561+
scan = heap_beginscan(relation, false, SnapshotNow, 1, entry);
562562
tuple = heap_getnext(scan, 0, (Buffer *) NULL);
563563
if (!HeapTupleIsValid(tuple))
564564
elog(ERROR, "IndexSupportInitialize: corrupted catalogs");
@@ -618,7 +618,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
618618
entry[1].sk_argument =
619619
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
620620

621-
scan = heap_beginscan(relation, false, false, 2, entry);
621+
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
622622

623623
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
624624
HeapTupleIsValid(tuple))
@@ -661,7 +661,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
661661
for (strategy = 1; strategy <= maxStrategyNumber; strategy++)
662662
ScanKeyEntrySetIllegal(StrategyMapGetScanKeyEntry(map, strategy));
663663

664-
scan = heap_beginscan(relation, false, false, 2, entry);
664+
scan = heap_beginscan(relation, false, SnapshotNow, 2, entry);
665665

666666
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
667667
HeapTupleIsValid(tuple))

src/backend/access/nbtree/nbtinsert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.26 1998/06/15 19:27:55 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.27 1998/07/27 19:37:39 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -120,7 +120,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
120120
{ /* they're equal */
121121
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
122122
itup = &(btitem->bti_itup);
123-
htup = heap_fetch(heapRel, true, &(itup->t_tid), NULL);
123+
htup = heap_fetch(heapRel, SnapshotSelf, &(itup->t_tid), NULL);
124124
if (htup != (HeapTuple) NULL)
125125
{ /* it is a duplicate */
126126
elog(ERROR, "Cannot insert a duplicate key into a unique index");

src/backend/access/nbtree/nbtree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.26 1998/06/15 19:27:56 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.27 1998/07/27 19:37:40 vadim Exp $
1212
*
1313
* NOTES
1414
* This file contains only the public interface routines.
@@ -153,7 +153,7 @@ btbuild(Relation heap,
153153
#endif /* OMIT_PARTIAL_INDEX */
154154

155155
/* start a heap scan */
156-
hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
156+
hscan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
157157
htup = heap_getnext(hscan, 0, &buffer);
158158

159159
/* build the index */

src/backend/access/rtree/rtree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.24 1998/06/15 19:28:01 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.25 1998/07/27 19:37:41 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -164,7 +164,7 @@ rtbuild(Relation heap,
164164
slot = NULL;
165165
}
166166
#endif /* OMIT_PARTIAL_INDEX */
167-
scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
167+
scan = heap_beginscan(heap, 0, SnapshotNow, 0, (ScanKey) NULL);
168168
htup = heap_getnext(scan, 0, &buffer);
169169

170170
/* count the tuples as we insert them */

src/backend/bootstrap/bootstrap.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.46 1998/07/26 04:30:19 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.47 1998/07/27 19:37:43 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -41,13 +41,8 @@
4141
#include "catalog/catname.h"
4242
#include "catalog/index.h"
4343
#include "catalog/pg_am.h"
44-
#ifdef MULTIBYTE
45-
#include "catalog/pg_attribute_mb.h"
46-
#include "catalog/pg_class_mb.h"
47-
#else
4844
#include "catalog/pg_attribute.h"
4945
#include "catalog/pg_class.h"
50-
#endif
5146
#include "catalog/pg_type.h"
5247
#include "executor/execdesc.h"
5348
#include "executor/hashjoin.h"
@@ -464,14 +459,14 @@ boot_openrel(char *relname)
464459
{
465460
StartPortalAllocMode(DefaultAllocMode, 0);
466461
rdesc = heap_openr(TypeRelationName);
467-
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
462+
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
468463
for (i = 0; PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)); ++i);
469464
heap_endscan(sdesc);
470465
app = Typ = ALLOC(struct typmap *, i + 1);
471466
while (i-- > 0)
472467
*app++ = ALLOC(struct typmap, 1);
473468
*app = (struct typmap *) NULL;
474-
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
469+
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
475470
app = Typ;
476471
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
477472
{
@@ -817,7 +812,7 @@ gettype(char *type)
817812
if (DebugMode)
818813
printf("bootstrap.c: External Type: %s\n", type);
819814
rdesc = heap_openr(TypeRelationName);
820-
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
815+
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
821816
i = 0;
822817
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
823818
++i;
@@ -826,7 +821,7 @@ gettype(char *type)
826821
while (i-- > 0)
827822
*app++ = ALLOC(struct typmap, 1);
828823
*app = (struct typmap *) NULL;
829-
sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
824+
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
830825
app = Typ;
831826
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
832827
{

src/backend/catalog/aclchk.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.11 1998/06/15 19:28:06 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.12 1998/07/27 19:37:45 vadim Exp $
1111
*
1212
* NOTES
1313
* See acl.h.
@@ -126,7 +126,7 @@ ChangeAcl(char *relname,
126126
relkey[0].sk_argument = NameGetDatum(relname);
127127
hsdp = heap_beginscan(relation,
128128
0,
129-
false,
129+
SnapshotNow,
130130
(unsigned) 1,
131131
relkey);
132132
htp = heap_getnext(hsdp, 0, &buffer);
@@ -482,7 +482,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
482482
&relkey[0].sk_func,
483483
&relkey[0].sk_nargs);
484484
relkey[0].sk_argument = NameGetDatum(relname);
485-
hsdp = heap_beginscan(relation, 0, false, 1, relkey);
485+
hsdp = heap_beginscan(relation, 0, SnapshotNow, 1, relkey);
486486
htp = heap_getnext(hsdp, 0, (Buffer *) 0);
487487
if (HeapTupleIsValid(htp) &&
488488
!heap_attisnull(htp, Anum_pg_class_relacl))

0 commit comments

Comments
 (0)