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

Commit346ed70

Browse files
committed
Rename RelationData.rd_amroutine to rd_indam.
The upcoming table AM support makes rd_amroutine to generic, as itsonly about index AMs. The new name makes that clear, and is shorter toboot.Author: Andres FreundDiscussion:https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
1 parentebcc7bf commit346ed70

File tree

9 files changed

+52
-52
lines changed

9 files changed

+52
-52
lines changed

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

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,27 @@
9898
#defineRELATION_CHECKS \
9999
( \
100100
AssertMacro(RelationIsValid(indexRelation)), \
101-
AssertMacro(PointerIsValid(indexRelation->rd_amroutine)), \
101+
AssertMacro(PointerIsValid(indexRelation->rd_indam)), \
102102
AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \
103103
)
104104

105105
#defineSCAN_CHECKS \
106106
( \
107107
AssertMacro(IndexScanIsValid(scan)), \
108108
AssertMacro(RelationIsValid(scan->indexRelation)), \
109-
AssertMacro(PointerIsValid(scan->indexRelation->rd_amroutine)) \
109+
AssertMacro(PointerIsValid(scan->indexRelation->rd_indam)) \
110110
)
111111

112112
#defineCHECK_REL_PROCEDURE(pname) \
113113
do { \
114-
if (indexRelation->rd_amroutine->pname == NULL) \
114+
if (indexRelation->rd_indam->pname == NULL) \
115115
elog(ERROR, "function %s is not defined for index %s", \
116116
CppAsString(pname), RelationGetRelationName(indexRelation)); \
117117
} while(0)
118118

119119
#defineCHECK_SCAN_PROCEDURE(pname) \
120120
do { \
121-
if (scan->indexRelation->rd_amroutine->pname == NULL) \
121+
if (scan->indexRelation->rd_indam->pname == NULL) \
122122
elog(ERROR, "function %s is not defined for index %s", \
123123
CppAsString(pname), RelationGetRelationName(scan->indexRelation)); \
124124
} while(0)
@@ -203,14 +203,14 @@ index_insert(Relation indexRelation,
203203
RELATION_CHECKS;
204204
CHECK_REL_PROCEDURE(aminsert);
205205

206-
if (!(indexRelation->rd_amroutine->ampredlocks))
206+
if (!(indexRelation->rd_indam->ampredlocks))
207207
CheckForSerializableConflictIn(indexRelation,
208208
(HeapTuple)NULL,
209209
InvalidBuffer);
210210

211-
returnindexRelation->rd_amroutine->aminsert(indexRelation,values,isnull,
212-
heap_t_ctid,heapRelation,
213-
checkUnique,indexInfo);
211+
returnindexRelation->rd_indam->aminsert(indexRelation,values,isnull,
212+
heap_t_ctid,heapRelation,
213+
checkUnique,indexInfo);
214214
}
215215

216216
/*
@@ -275,7 +275,7 @@ index_beginscan_internal(Relation indexRelation,
275275
RELATION_CHECKS;
276276
CHECK_REL_PROCEDURE(ambeginscan);
277277

278-
if (!(indexRelation->rd_amroutine->ampredlocks))
278+
if (!(indexRelation->rd_indam->ampredlocks))
279279
PredicateLockRelation(indexRelation,snapshot);
280280

281281
/*
@@ -286,8 +286,8 @@ index_beginscan_internal(Relation indexRelation,
286286
/*
287287
* Tell the AM to open a scan.
288288
*/
289-
scan=indexRelation->rd_amroutine->ambeginscan(indexRelation,nkeys,
290-
norderbys);
289+
scan=indexRelation->rd_indam->ambeginscan(indexRelation,nkeys,
290+
norderbys);
291291
/* Initialize information for parallel scan. */
292292
scan->parallel_scan=pscan;
293293
scan->xs_temp_snap=temp_snap;
@@ -329,8 +329,8 @@ index_rescan(IndexScanDesc scan,
329329

330330
scan->kill_prior_tuple= false;/* for safety */
331331

332-
scan->indexRelation->rd_amroutine->amrescan(scan,keys,nkeys,
333-
orderbys,norderbys);
332+
scan->indexRelation->rd_indam->amrescan(scan,keys,nkeys,
333+
orderbys,norderbys);
334334
}
335335

336336
/* ----------------
@@ -351,7 +351,7 @@ index_endscan(IndexScanDesc scan)
351351
}
352352

353353
/* End the AM's scan */
354-
scan->indexRelation->rd_amroutine->amendscan(scan);
354+
scan->indexRelation->rd_indam->amendscan(scan);
355355

356356
/* Release index refcount acquired by index_beginscan */
357357
RelationDecrementReferenceCount(scan->indexRelation);
@@ -373,7 +373,7 @@ index_markpos(IndexScanDesc scan)
373373
SCAN_CHECKS;
374374
CHECK_SCAN_PROCEDURE(ammarkpos);
375375

376-
scan->indexRelation->rd_amroutine->ammarkpos(scan);
376+
scan->indexRelation->rd_indam->ammarkpos(scan);
377377
}
378378

379379
/* ----------------
@@ -404,7 +404,7 @@ index_restrpos(IndexScanDesc scan)
404404

405405
scan->kill_prior_tuple= false;/* for safety */
406406

407-
scan->indexRelation->rd_amroutine->amrestrpos(scan);
407+
scan->indexRelation->rd_indam->amrestrpos(scan);
408408
}
409409

410410
/*
@@ -430,9 +430,9 @@ index_parallelscan_estimate(Relation indexRelation, Snapshot snapshot)
430430
* AM-specific data needed. (It's hard to believe that could work, but
431431
* it's easy enough to cater to it here.)
432432
*/
433-
if (indexRelation->rd_amroutine->amestimateparallelscan!=NULL)
433+
if (indexRelation->rd_indam->amestimateparallelscan!=NULL)
434434
nbytes=add_size(nbytes,
435-
indexRelation->rd_amroutine->amestimateparallelscan());
435+
indexRelation->rd_indam->amestimateparallelscan());
436436

437437
returnnbytes;
438438
}
@@ -465,12 +465,12 @@ index_parallelscan_initialize(Relation heapRelation, Relation indexRelation,
465465
SerializeSnapshot(snapshot,target->ps_snapshot_data);
466466

467467
/* aminitparallelscan is optional; assume no-op if not provided by AM */
468-
if (indexRelation->rd_amroutine->aminitparallelscan!=NULL)
468+
if (indexRelation->rd_indam->aminitparallelscan!=NULL)
469469
{
470470
void*amtarget;
471471

472472
amtarget=OffsetToPointer(target,offset);
473-
indexRelation->rd_amroutine->aminitparallelscan(amtarget);
473+
indexRelation->rd_indam->aminitparallelscan(amtarget);
474474
}
475475
}
476476

@@ -484,8 +484,8 @@ index_parallelrescan(IndexScanDesc scan)
484484
SCAN_CHECKS;
485485

486486
/* amparallelrescan is optional; assume no-op if not provided by AM */
487-
if (scan->indexRelation->rd_amroutine->amparallelrescan!=NULL)
488-
scan->indexRelation->rd_amroutine->amparallelrescan(scan);
487+
if (scan->indexRelation->rd_indam->amparallelrescan!=NULL)
488+
scan->indexRelation->rd_indam->amparallelrescan(scan);
489489
}
490490

491491
/*
@@ -539,7 +539,7 @@ index_getnext_tid(IndexScanDesc scan, ScanDirection direction)
539539
* scan->xs_recheck and possibly scan->xs_itup/scan->xs_hitup, though we
540540
* pay no attention to those fields here.
541541
*/
542-
found=scan->indexRelation->rd_amroutine->amgettuple(scan,direction);
542+
found=scan->indexRelation->rd_indam->amgettuple(scan,direction);
543543

544544
/* Reset kill flag immediately for safety */
545545
scan->kill_prior_tuple= false;
@@ -724,7 +724,7 @@ index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap)
724724
/*
725725
* have the am's getbitmap proc do all the work.
726726
*/
727-
ntids=scan->indexRelation->rd_amroutine->amgetbitmap(scan,bitmap);
727+
ntids=scan->indexRelation->rd_indam->amgetbitmap(scan,bitmap);
728728

729729
pgstat_count_index_tuples(scan->indexRelation,ntids);
730730

@@ -751,8 +751,8 @@ index_bulk_delete(IndexVacuumInfo *info,
751751
RELATION_CHECKS;
752752
CHECK_REL_PROCEDURE(ambulkdelete);
753753

754-
returnindexRelation->rd_amroutine->ambulkdelete(info,stats,
755-
callback,callback_state);
754+
returnindexRelation->rd_indam->ambulkdelete(info,stats,
755+
callback,callback_state);
756756
}
757757

758758
/* ----------------
@@ -770,7 +770,7 @@ index_vacuum_cleanup(IndexVacuumInfo *info,
770770
RELATION_CHECKS;
771771
CHECK_REL_PROCEDURE(amvacuumcleanup);
772772

773-
returnindexRelation->rd_amroutine->amvacuumcleanup(info,stats);
773+
returnindexRelation->rd_indam->amvacuumcleanup(info,stats);
774774
}
775775

776776
/* ----------------
@@ -786,10 +786,10 @@ index_can_return(Relation indexRelation, int attno)
786786
RELATION_CHECKS;
787787

788788
/* amcanreturn is optional; assume false if not provided by AM */
789-
if (indexRelation->rd_amroutine->amcanreturn==NULL)
789+
if (indexRelation->rd_indam->amcanreturn==NULL)
790790
return false;
791791

792-
returnindexRelation->rd_amroutine->amcanreturn(indexRelation,attno);
792+
returnindexRelation->rd_indam->amcanreturn(indexRelation,attno);
793793
}
794794

795795
/* ----------------
@@ -827,7 +827,7 @@ index_getprocid(Relation irel,
827827
intnproc;
828828
intprocindex;
829829

830-
nproc=irel->rd_amroutine->amsupport;
830+
nproc=irel->rd_indam->amsupport;
831831

832832
Assert(procnum>0&&procnum <= (uint16)nproc);
833833

@@ -861,7 +861,7 @@ index_getprocinfo(Relation irel,
861861
intnproc;
862862
intprocindex;
863863

864-
nproc=irel->rd_amroutine->amsupport;
864+
nproc=irel->rd_indam->amsupport;
865865

866866
Assert(procnum>0&&procnum <= (uint16)nproc);
867867

‎src/backend/catalog/index.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,9 +2248,9 @@ index_build(Relation heapRelation,
22482248
* sanity checks
22492249
*/
22502250
Assert(RelationIsValid(indexRelation));
2251-
Assert(PointerIsValid(indexRelation->rd_amroutine));
2252-
Assert(PointerIsValid(indexRelation->rd_amroutine->ambuild));
2253-
Assert(PointerIsValid(indexRelation->rd_amroutine->ambuildempty));
2251+
Assert(PointerIsValid(indexRelation->rd_indam));
2252+
Assert(PointerIsValid(indexRelation->rd_indam->ambuild));
2253+
Assert(PointerIsValid(indexRelation->rd_indam->ambuildempty));
22542254

22552255
/*
22562256
* Determine worker process details for parallel CREATE INDEX. Currently,
@@ -2291,8 +2291,8 @@ index_build(Relation heapRelation,
22912291
/*
22922292
* Call the access method's build procedure
22932293
*/
2294-
stats=indexRelation->rd_amroutine->ambuild(heapRelation,indexRelation,
2295-
indexInfo);
2294+
stats=indexRelation->rd_indam->ambuild(heapRelation,indexRelation,
2295+
indexInfo);
22962296
Assert(PointerIsValid(stats));
22972297

22982298
/*
@@ -2307,7 +2307,7 @@ index_build(Relation heapRelation,
23072307
{
23082308
RelationOpenSmgr(indexRelation);
23092309
smgrcreate(indexRelation->rd_smgr,INIT_FORKNUM, false);
2310-
indexRelation->rd_amroutine->ambuildempty(indexRelation);
2310+
indexRelation->rd_indam->ambuildempty(indexRelation);
23112311
}
23122312

23132313
/*

‎src/backend/commands/cluster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMOD
444444
RelationGetRelationName(OldHeap))));
445445

446446
/* Index AM must allow clustering */
447-
if (!OldIndex->rd_amroutine->amclusterable)
447+
if (!OldIndex->rd_indam->amclusterable)
448448
ereport(ERROR,
449449
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
450450
errmsg("cannot cluster on index \"%s\" because access method does not support clustering",

‎src/backend/commands/tablecmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11121,7 +11121,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1112111121
break;
1112211122
caseRELKIND_INDEX:
1112311123
caseRELKIND_PARTITIONED_INDEX:
11124-
(void)index_reloptions(rel->rd_amroutine->amoptions,newOptions, true);
11124+
(void)index_reloptions(rel->rd_indam->amoptions,newOptions, true);
1112511125
break;
1112611126
default:
1112711127
ereport(ERROR,
@@ -12876,7 +12876,7 @@ ATExecReplicaIdentity(Relation rel, ReplicaIdentityStmt *stmt, LOCKMODE lockmode
1287612876
RelationGetRelationName(indexRel),
1287712877
RelationGetRelationName(rel))));
1287812878
/* The AM must support uniqueness, and the index must in fact be unique. */
12879-
if (!indexRel->rd_amroutine->amcanunique||
12879+
if (!indexRel->rd_indam->amcanunique||
1288012880
!indexRel->rd_index->indisunique)
1288112881
ereport(ERROR,
1288212882
(errcode(ERRCODE_WRONG_OBJECT_TYPE),

‎src/backend/executor/nodeIndexscan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
15271527

15281528
Assert(rightop!=NULL);
15291529

1530-
if (index->rd_amroutine->amsearcharray)
1530+
if (index->rd_indam->amsearcharray)
15311531
{
15321532
/* Index AM will handle this like a simple operator */
15331533
flags |=SK_SEARCHARRAY;

‎src/backend/optimizer/util/plancat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
263263

264264
info->relam=indexRelation->rd_rel->relam;
265265

266-
/* We copy just the fields we need, not all ofrd_amroutine */
267-
amroutine=indexRelation->rd_amroutine;
266+
/* We copy just the fields we need, not all ofrd_indam */
267+
amroutine=indexRelation->rd_indam;
268268
info->amcanorderbyop=amroutine->amcanorderbyop;
269269
info->amoptionalkey=amroutine->amoptionalkey;
270270
info->amsearcharray=amroutine->amsearcharray;

‎src/backend/parser/parse_utilcmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ generateClonedIndexStmt(RangeVar *heapRel, Oid heapRelid, Relation source_idx,
15041504
iparam->nulls_ordering=SORTBY_NULLS_DEFAULT;
15051505

15061506
/* Adjust options if necessary */
1507-
if (source_idx->rd_amroutine->amcanorder)
1507+
if (source_idx->rd_indam->amcanorder)
15081508
{
15091509
/*
15101510
* If it supports sort ordering, copy DESC and NULLS opts. Don't

‎src/backend/utils/cache/relcache.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ AllocateRelationDesc(Form_pg_class relp)
426426
*
427427
* tuple is the real pg_class tuple (not rd_rel!) for relation
428428
*
429-
* Note: rd_rel and (if an index)rd_amroutine must be valid already
429+
* Note: rd_rel and (if an index)rd_indam must be valid already
430430
*/
431431
staticvoid
432432
RelationParseRelOptions(Relationrelation,HeapTupletuple)
@@ -451,7 +451,7 @@ RelationParseRelOptions(Relation relation, HeapTuple tuple)
451451
break;
452452
caseRELKIND_INDEX:
453453
caseRELKIND_PARTITIONED_INDEX:
454-
amoptsfn=relation->rd_amroutine->amoptions;
454+
amoptsfn=relation->rd_indam->amoptions;
455455
break;
456456
default:
457457
return;
@@ -1331,7 +1331,7 @@ InitIndexAmRoutine(Relation relation)
13311331
cached= (IndexAmRoutine*)MemoryContextAlloc(relation->rd_indexcxt,
13321332
sizeof(IndexAmRoutine));
13331333
memcpy(cached,tmp,sizeof(IndexAmRoutine));
1334-
relation->rd_amroutine=cached;
1334+
relation->rd_indam=cached;
13351335

13361336
pfree(tmp);
13371337
}
@@ -1416,7 +1416,7 @@ RelationInitIndexAccessInfo(Relation relation)
14161416
relation->rd_opcintype= (Oid*)
14171417
MemoryContextAllocZero(indexcxt,indnkeyatts*sizeof(Oid));
14181418

1419-
amsupport=relation->rd_amroutine->amsupport;
1419+
amsupport=relation->rd_indam->amsupport;
14201420
if (amsupport>0)
14211421
{
14221422
intnsupport=indnatts*amsupport;
@@ -5404,7 +5404,7 @@ load_relcache_init_file(bool shared)
54045404
rel->rd_indoption=indoption;
54055405

54065406
/* set up zeroed fmgr-info vector */
5407-
nsupport=relform->relnatts*rel->rd_amroutine->amsupport;
5407+
nsupport=relform->relnatts*rel->rd_indam->amsupport;
54085408
rel->rd_supportinfo= (FmgrInfo*)
54095409
MemoryContextAllocZero(indexcxt,nsupport*sizeof(FmgrInfo));
54105410
}
@@ -5417,7 +5417,7 @@ load_relcache_init_file(bool shared)
54175417
Assert(rel->rd_index==NULL);
54185418
Assert(rel->rd_indextuple==NULL);
54195419
Assert(rel->rd_indexcxt==NULL);
5420-
Assert(rel->rd_amroutine==NULL);
5420+
Assert(rel->rd_indam==NULL);
54215421
Assert(rel->rd_opfamily==NULL);
54225422
Assert(rel->rd_opcintype==NULL);
54235423
Assert(rel->rd_support==NULL);
@@ -5695,7 +5695,7 @@ write_relcache_init_file(bool shared)
56955695

56965696
/* next, write the vector of support procedure OIDs */
56975697
write_item(rel->rd_support,
5698-
relform->relnatts* (rel->rd_amroutine->amsupport*sizeof(RegProcedure)),
5698+
relform->relnatts* (rel->rd_indam->amsupport*sizeof(RegProcedure)),
56995699
fp);
57005700

57015701
/* next, write the vector of collation OIDs */

‎src/include/utils/rel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ typedef struct RelationData
147147
Oidrd_amhandler;/* OID of index AM's handler function */
148148
MemoryContextrd_indexcxt;/* private memory cxt for this stuff */
149149
/* use "struct" here to avoid needing to include amapi.h: */
150-
structIndexAmRoutine*rd_amroutine;/* index AM's API struct */
150+
structIndexAmRoutine*rd_indam;/* index AM's API struct */
151151
Oid*rd_opfamily;/* OIDs of op families for each index col */
152152
Oid*rd_opcintype;/* OIDs of opclass declared input data types */
153153
RegProcedure*rd_support;/* OIDs of support procedures */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp