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

Commitf1d5d09

Browse files
committed
Tweak StrategyEvaluation data structure to eliminate hardwired limit on
number of strategies supported by an index AM. Add missing copyrightnotices and CVS $Header$ markers to GIST source files.
1 parentf504ad1 commitf1d5d09

File tree

12 files changed

+139
-150
lines changed

12 files changed

+139
-150
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
* interface routines for the postgres GiST index access method.
55
*
66
*
7+
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8+
* Portions Copyright (c) 1994, Regents of the University of California
79
*
810
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.76 2001/05/15 14:14:49 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.77 2001/05/30 19:53:39 tgl Exp $
1012
*
1113
*-------------------------------------------------------------------------
1214
*/
13-
1415
#include"postgres.h"
1516

1617
#include"access/genam.h"
@@ -22,9 +23,9 @@
2223
#include"executor/executor.h"
2324
#include"miscadmin.h"
2425
#include"utils/syscache.h"
25-
2626
#include"access/xlogutils.h"
2727

28+
2829
/* result's status */
2930
#defineINSERTED0x01
3031
#defineSPLITED0x02
@@ -78,9 +79,9 @@ static void gistcentryinit(GISTSTATE *giststate,
7879
OffsetNumbero,intb,booll);
7980

8081
#undef GISTDEBUG
82+
8183
#ifdefGISTDEBUG
8284
staticvoidgist_dumptree(Relationr,intlevel,BlockNumberblk,OffsetNumbercoff);
83-
8485
#endif
8586

8687
/*

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
* fetch tuples from a GiST scan.
55
*
66
*
7+
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8+
* Portions Copyright (c) 1994, Regents of the University of California
79
*
810
* IDENTIFICATION
9-
*/usr/local/devel/pglite/cvs/src/backend/access/gisr/gistget.c,v 1.9.1 1996/11/21 01:00:00 vadim Exp
11+
*$Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.27 2001/05/30 19:53:40 tgl Exp $
1012
*
1113
*-------------------------------------------------------------------------
1214
*/
13-
1415
#include"postgres.h"
1516

1617
#include"access/gist.h"
1718
#include"executor/execdebug.h"
1819

1920

20-
2121
staticOffsetNumbergistfindnext(IndexScanDescs,Pagep,OffsetNumbern,
2222
ScanDirectiondir);
2323
staticRetrieveIndexResultgistscancache(IndexScanDescs,ScanDirectiondir);

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*-------------------------------------------------------------------------
22
*
33
* gistscan.c
4-
* routines to manage scans on index relations
4+
* routines to manage scans onGiSTindex relations
55
*
66
*
7+
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8+
* Portions Copyright (c) 1994, Regents of the University of California
9+
*
710
* IDENTIFICATION
8-
*/usr/local/devel/pglite/cvs/src/backend/access/gist/gistscan.c,v 1.7 1995/06/14 00:10:05 jolly Exp
11+
*$Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.34 2001/05/30 19:53:40 tgl Exp $
912
*
1013
*-------------------------------------------------------------------------
1114
*/
12-
1315
#include"postgres.h"
1416

1517
#include"access/genam.h"

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
* giststrat.c
44
* strategy map data for GiSTs.
55
*
6+
*
67
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
78
* Portions Copyright (c) 1994, Regents of the University of California
89
*
9-
*
1010
* IDENTIFICATION
11-
*/usr/local/devel/pglite/cvs/src/backend/access/gist/giststrat.c,v 1.4 1995/06/14 00:10:05 jolly Exp
11+
*$Header: /cvsroot/pgsql/src/backend/access/gist/Attic/giststrat.c,v 1.17 2001/05/30 19:53:40 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
15-
1615
#include"postgres.h"
1716

1817
#include"access/gist.h"
1918
#include"access/istrat.h"
2019

20+
2121
/*
2222
*Note: negate, commute, and negatecommute all assume that operators are
2323
* ordered as follows in the strategy map:
@@ -71,6 +71,12 @@ static StrategyNumber GISTNegateCommute[GISTNStrategies] = {
7171
* TermData) -- such logic must be encoded in the user's Consistent function.
7272
*/
7373

74+
staticStrategyExpressionGISTEvaluationExpressions[GISTNStrategies]= {
75+
NULL,
76+
NULL,
77+
NULL
78+
};
79+
7480
/*
7581
*If you were sufficiently attentive to detail, you would go through
7682
*the ExpressionData pain above for every one of the strategies
@@ -92,9 +98,10 @@ static StrategyEvaluationData GISTEvaluationData = {
9298
(StrategyTransformMap)GISTNegate,/* how to do (not qual) */
9399
(StrategyTransformMap)GISTCommute,/* how to swap operands */
94100
(StrategyTransformMap)GISTNegateCommute,/* how to do both */
95-
{NULL}
101+
GISTEvaluationExpressions
96102
};
97103

104+
98105
StrategyNumber
99106
RelationGetGISTStrategy(Relationr,
100107
AttrNumberattnum,

‎src/backend/access/hash/hashstrat.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,50 @@
11
/*-------------------------------------------------------------------------
22
*
3-
*btstrat.c
4-
* Srategy map entries for thebtree indexed access method
3+
*hashstrat.c
4+
* Srategy map entries for thehash indexed access method
55
*
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.17 2001/01/24 19:42:47 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.18 2001/05/30 19:53:40 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
15-
1615
#include"postgres.h"
1716

17+
#include"access/hash.h"
18+
1819

1920
/*
2021
*only one valid strategy for hash tables: equality.
2122
*/
2223

2324
#ifdefNOT_USED
24-
staticStrategyNumberHTNegate[1]= {
25+
26+
staticStrategyNumberHTNegate[HTMaxStrategyNumber]= {
2527
InvalidStrategy
2628
};
2729

28-
staticStrategyNumberHTCommute[1]= {
30+
staticStrategyNumberHTCommute[HTMaxStrategyNumber]= {
2931
HTEqualStrategyNumber
3032
};
3133

32-
staticStrategyNumberHTNegateCommute[1]= {
34+
staticStrategyNumberHTNegateCommute[HTMaxStrategyNumber]= {
3335
InvalidStrategy
3436
};
3537

36-
staticStrategyEvaluationDataHTEvaluationData= {
37-
/* XXX static for simplicity */
38+
staticStrategyExpressionHTEvaluationExpressions[HTMaxStrategyNumber]= {
39+
NULL
40+
};
3841

42+
staticStrategyEvaluationDataHTEvaluationData= {
3943
HTMaxStrategyNumber,
4044
(StrategyTransformMap)HTNegate,
4145
(StrategyTransformMap)HTCommute,
4246
(StrategyTransformMap)HTNegateCommute,
43-
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}
47+
HTEvaluationExpressions
4448
};
4549

4650
#endif

‎src/backend/access/index/istrat.c

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.49 2001/03/22 03:59:13 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.50 2001/05/30 19:53:40 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
16-
1716
#include"postgres.h"
1817

1918
#include"access/heapam.h"
@@ -37,7 +36,6 @@ static bool StrategyOperatorIsValid(StrategyOperator operator,
3736
StrategyNumbermaxStrategy);
3837
staticboolStrategyTermIsValid(StrategyTermterm,
3938
StrategyNumbermaxStrategy);
40-
4139
#endif
4240

4341

@@ -188,19 +186,13 @@ StrategyEvaluationIsValid(StrategyEvaluation evaluation)
188186
!StrategyTransformMapIsValid(evaluation->negateTransform)||
189187
!StrategyTransformMapIsValid(evaluation->commuteTransform)||
190188
!StrategyTransformMapIsValid(evaluation->negateCommuteTransform))
191-
{
192-
193189
return false;
194-
}
195190

196191
for (index=0;index<evaluation->maxStrategy;index+=1)
197192
{
198193
if (!StrategyExpressionIsValid(evaluation->expression[index],
199194
evaluation->maxStrategy))
200-
{
201-
202195
return false;
203-
}
204196
}
205197
return true;
206198
}
@@ -268,6 +260,8 @@ StrategyTermEvaluate(StrategyTerm term,
268260

269261
/* ----------------
270262
*RelationGetStrategy
263+
*
264+
* Identify strategy number that describes given procedure, if there is one.
271265
* ----------------
272266
*/
273267
StrategyNumber
@@ -286,8 +280,7 @@ RelationGetStrategy(Relation relation,
286280
numattrs=RelationGetNumberOfAttributes(relation);
287281

288282
Assert(relation->rd_rel->relkind==RELKIND_INDEX);/* XXX use accessor */
289-
Assert(AttributeNumberIsValid(attributeNumber));
290-
Assert((attributeNumber >=1)&& (attributeNumber<1+numattrs));
283+
Assert((attributeNumber >=1)&& (attributeNumber <=numattrs));
291284

292285
Assert(StrategyEvaluationIsValid(evaluation));
293286
Assert(RegProcedureIsValid(procedure));
@@ -332,7 +325,6 @@ RelationGetStrategy(Relation relation,
332325
elog(FATAL,"RelationGetStrategy: impossible case %d",entry->sk_flags);
333326
}
334327

335-
336328
if (!StrategyNumberIsInBounds(strategy,evaluation->maxStrategy))
337329
{
338330
if (!StrategyNumberIsValid(strategy))
@@ -391,7 +383,6 @@ RelationInvokeStrategy(Relation relation,
391383
newStrategy=evaluation->negateTransform->strategy[strategy-1];
392384
if (newStrategy!=strategy&&StrategyNumberIsValid(newStrategy))
393385
{
394-
395386
entry=StrategyMapGetScanKeyEntry(strategyMap,newStrategy);
396387

397388
if (RegProcedureIsValid(entry->sk_procedure))
@@ -406,7 +397,6 @@ RelationInvokeStrategy(Relation relation,
406397
newStrategy=evaluation->commuteTransform->strategy[strategy-1];
407398
if (newStrategy!=strategy&&StrategyNumberIsValid(newStrategy))
408399
{
409-
410400
entry=StrategyMapGetScanKeyEntry(strategyMap,newStrategy);
411401

412402
if (RegProcedureIsValid(entry->sk_procedure))
@@ -421,7 +411,6 @@ RelationInvokeStrategy(Relation relation,
421411
newStrategy=evaluation->negateCommuteTransform->strategy[strategy-1];
422412
if (newStrategy!=strategy&&StrategyNumberIsValid(newStrategy))
423413
{
424-
425414
entry=StrategyMapGetScanKeyEntry(strategyMap,newStrategy);
426415

427416
if (RegProcedureIsValid(entry->sk_procedure))
@@ -463,8 +452,6 @@ RelationInvokeStrategy(Relation relation,
463452

464453
/* not reached, just to make compiler happy */
465454
return FALSE;
466-
467-
468455
}
469456

470457
#endif
@@ -614,16 +601,16 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
614601
ObjectIdGetDatum(accessMethodObjectId));
615602

616603
ScanKeyEntryInitialize(&entry[1],0,Anum_pg_amproc_amopclaid,
617-
F_OIDEQ,0);
604+
F_OIDEQ,
605+
InvalidOid);/* will set below */
618606

619607
relation=heap_openr(AccessMethodProcedureRelationName,
620608
AccessShareLock);
621609

622610
for (attNumber=1;attNumber <=maxAttributeNumber;attNumber++)
623611
{
624-
int16support;
625-
Form_pg_amprocaform;
626612
RegProcedure*loc;
613+
StrategyNumbersupport;
627614

628615
loc=&indexSupport[((attNumber-1)*maxSupportNumber)];
629616

@@ -637,8 +624,12 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
637624

638625
while (HeapTupleIsValid(tuple=heap_getnext(scan,0)))
639626
{
627+
Form_pg_amprocaform;
628+
640629
aform= (Form_pg_amproc)GETSTRUCT(tuple);
641-
loc[(aform->amprocnum-1)]=aform->amproc;
630+
support=aform->amprocnum;
631+
Assert(support>0&&support <=maxSupportNumber);
632+
loc[support-1]=aform->amproc;
642633
}
643634

644635
heap_endscan(scan);
@@ -708,7 +699,6 @@ IndexStrategyDisplay(IndexStrategy indexStrategy,
708699
for (attributeNumber=1;attributeNumber <=numberOfAttributes;
709700
attributeNumber+=1)
710701
{
711-
712702
strategyMap=IndexStrategyGetStrategyMap(indexStrategy,
713703
numberOfStrategies,
714704
attributeNumber);
@@ -717,7 +707,6 @@ IndexStrategyDisplay(IndexStrategy indexStrategy,
717707
strategyNumber <=AMStrategies(numberOfStrategies);
718708
strategyNumber+=1)
719709
{
720-
721710
printf(":att %d\t:str %d\t:opr 0x%x(%d)\n",
722711
attributeNumber,strategyNumber,
723712
strategyMap->entry[strategyNumber-1].sk_procedure,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp