Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44fbe20

Browse files
committed
Restructure indexscan API (index_beginscan, index_getnext) per
yesterday's proposal to pghackers. Also remove unnecessary parametersto heap_beginscan, heap_rescan. I modified pg_proc.h to reflect thenew numbers of parameters for the AM interface routines, but did notforce an initdb because nothing actually looks at those fields.
1 parentc961474 commit44fbe20

File tree

59 files changed

+833
-1282
lines changed

Some content is hidden

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

59 files changed

+833
-1282
lines changed

‎contrib/dblink/dblink.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,9 @@ get_pkey_attnames(Oid relid, int16 *numatts)
922922
indexRelation=heap_openr(IndexRelationName,AccessShareLock);
923923
ScanKeyEntryInitialize(&entry,0,Anum_pg_index_indrelid,
924924
F_OIDEQ,ObjectIdGetDatum(relid));
925-
scan=heap_beginscan(indexRelation, false,SnapshotNow,
926-
1,&entry);
925+
scan=heap_beginscan(indexRelation,SnapshotNow,1,&entry);
927926

928-
while (HeapTupleIsValid(indexTuple=heap_getnext(scan,0)))
927+
while ((indexTuple=heap_getnext(scan,ForwardScanDirection))!=NULL)
929928
{
930929
Form_pg_indexindex= (Form_pg_index)GETSTRUCT(indexTuple);
931930

‎contrib/dbsize/dbsize.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ database_size(PG_FUNCTION_ARGS)
5959
relation=heap_openr(DatabaseRelationName,AccessShareLock);
6060
ScanKeyEntryInitialize(&scanKey,0,Anum_pg_database_datname,
6161
F_NAMEEQ,NameGetDatum(dbname));
62-
scan=heap_beginscan(relation,0,SnapshotNow,1,&scanKey);
63-
tuple=heap_getnext(scan,0);
62+
scan=heap_beginscan(relation,SnapshotNow,1,&scanKey);
63+
tuple=heap_getnext(scan,ForwardScanDirection);
6464

6565
if (!HeapTupleIsValid(tuple))
6666
elog(ERROR,"database %s does not exist",NameStr(*dbname));

‎contrib/miscutil/misc_utils.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ active_listeners(text *relname)
9393
Anum_pg_listener_relname,
9494
F_NAMEEQ,
9595
PointerGetDatum(listen_name));
96-
sRel=heap_beginscan(lRel,0,SnapshotNow,1,&key);
96+
sRel=heap_beginscan(lRel,SnapshotNow,1,&key);
9797
}
9898
else
99-
sRel=heap_beginscan(lRel,0,SnapshotNow,0, (ScanKey)NULL);
99+
sRel=heap_beginscan(lRel,SnapshotNow,0, (ScanKey)NULL);
100100

101-
while (HeapTupleIsValid(lTuple=heap_getnext(sRel,0)))
101+
while ((lTuple=heap_getnext(sRel,ForwardScanDirection))!=NULL)
102102
{
103103
d=heap_getattr(lTuple,Anum_pg_listener_pid,tdesc,&isnull);
104104
pid=DatumGetInt32(d);
@@ -111,14 +111,3 @@ active_listeners(text *relname)
111111

112112
returncount;
113113
}
114-
115-
116-
/* end of file */
117-
118-
/*
119-
* Local Variables:
120-
*tab-width: 4
121-
*c-indent-level: 4
122-
*c-basic-offset: 4
123-
* End:
124-
*/

‎contrib/pgstattuple/pgstattuple.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.5 2002/03/30 01:02:41 tgl Exp $
2+
* $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.6 2002/05/20 23:51:40 tgl Exp $
33
*
44
* Copyright (c) 2001 Tatsuo Ishii
55
*
@@ -70,9 +70,9 @@ pgstattuple(PG_FUNCTION_ARGS)
7070
rel=heap_openrv(relrv,AccessShareLock);
7171

7272
nblocks=RelationGetNumberOfBlocks(rel);
73-
scan=heap_beginscan(rel,false,SnapshotAny,0,NULL);
73+
scan=heap_beginscan(rel,SnapshotAny,0,NULL);
7474

75-
while ((tuple=heap_getnext(scan,0)))
75+
while ((tuple=heap_getnext(scan,ForwardScanDirection))!=NULL)
7676
{
7777
if (HeapTupleSatisfiesNow(tuple->t_data))
7878
{

‎src/backend/access/common/indextuple.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.55 2001/10/25 05:49:20 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.56 2002/05/20 23:51:40 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -398,23 +398,6 @@ nocache_index_getattr(IndexTuple tup,
398398
}
399399
}
400400

401-
RetrieveIndexResult
402-
FormRetrieveIndexResult(ItemPointerindexItemPointer,
403-
ItemPointerheapItemPointer)
404-
{
405-
RetrieveIndexResultresult;
406-
407-
Assert(ItemPointerIsValid(indexItemPointer));
408-
Assert(ItemPointerIsValid(heapItemPointer));
409-
410-
result= (RetrieveIndexResult)palloc(sizeof*result);
411-
412-
result->index_iptr=*indexItemPointer;
413-
result->heap_iptr=*heapItemPointer;
414-
415-
returnresult;
416-
}
417-
418401
/*
419402
* Copies source into target. If *target == NULL, we palloc space; otherwise
420403
* we assume we have space that is already palloc'ed.
@@ -423,12 +406,10 @@ void
423406
CopyIndexTuple(IndexTuplesource,IndexTuple*target)
424407
{
425408
Sizesize;
426-
IndexTupleret;
427409

428410
size=IndexTupleSize(source);
429411
if (*target==NULL)
430412
*target= (IndexTuple)palloc(size);
431413

432-
ret=*target;
433-
memmove((char*)ret, (char*)source,size);
414+
memmove((char*)*target, (char*)source,size);
434415
}

‎src/backend/access/gist/gist.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.91 2002/03/06 06:09:15 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.92 2002/05/20 23:51:40 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1590,7 +1590,6 @@ gistbulkdelete(PG_FUNCTION_ARGS)
15901590
BlockNumbernum_pages;
15911591
doubletuples_removed;
15921592
doublenum_index_tuples;
1593-
RetrieveIndexResultres;
15941593
IndexScanDesciscan;
15951594

15961595
tuples_removed=0;
@@ -1607,23 +1606,20 @@ gistbulkdelete(PG_FUNCTION_ARGS)
16071606
*/
16081607

16091608
/* walk through the entire index */
1610-
iscan=index_beginscan(rel,false,0, (ScanKey)NULL);
1609+
iscan=index_beginscan(NULL,rel,SnapshotAny,0, (ScanKey)NULL);
16111610

1612-
while ((res=index_getnext(iscan,ForwardScanDirection))
1613-
!= (RetrieveIndexResult)NULL)
1611+
while (index_getnext_indexitem(iscan,ForwardScanDirection))
16141612
{
1615-
ItemPointerheapptr=&res->heap_iptr;
1616-
1617-
if (callback(heapptr,callback_state))
1613+
if (callback(&iscan->xs_ctup.t_self,callback_state))
16181614
{
1619-
ItemPointerindexptr=&res->index_iptr;
1615+
ItemPointerDataindextup=iscan->currentItemData;
16201616
BlockNumberblkno;
16211617
OffsetNumberoffnum;
16221618
Bufferbuf;
16231619
Pagepage;
16241620

1625-
blkno=ItemPointerGetBlockNumber(indexptr);
1626-
offnum=ItemPointerGetOffsetNumber(indexptr);
1621+
blkno=ItemPointerGetBlockNumber(&indextup);
1622+
offnum=ItemPointerGetOffsetNumber(&indextup);
16271623

16281624
/* adjust any scans that will be affected by this deletion */
16291625
gistadjscans(rel,GISTOP_DEL,blkno,offnum);
@@ -1640,8 +1636,6 @@ gistbulkdelete(PG_FUNCTION_ARGS)
16401636
}
16411637
else
16421638
num_index_tuples+=1;
1643-
1644-
pfree(res);
16451639
}
16461640

16471641
index_endscan(iscan);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp