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

Commit4bac960

Browse files
Harmonize heapam and tableam parameter names.
Make sure that function declarations use names that exactly match thecorresponding names from function definitions. Having parameter namesthat are reliably consistent in this way will make it easier to reasonabout groups of related C functions from the same translation unit as amodule. It will also make certain refactoring tasks easier.Like other recent commits that cleaned up function parameter names, thiscommit was written with help from clang-tidy. Later commits will do thesame for other parts of the codebase.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: David Rowley <dgrowleyml@gmail.com>Discussion:https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
1 parentcb8ff7e commit4bac960

File tree

14 files changed

+90
-89
lines changed

14 files changed

+90
-89
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,13 @@ heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
420420
* ----------------
421421
*/
422422
Datum
423-
nocachegetattr(HeapTupletuple,
423+
nocachegetattr(HeapTupletup,
424424
intattnum,
425425
TupleDesctupleDesc)
426426
{
427-
HeapTupleHeadertup=tuple->t_data;
427+
HeapTupleHeadertd=tup->t_data;
428428
char*tp;/* ptr to data part of tuple */
429-
bits8*bp=tup->t_bits;/* ptr to null bitmap in tuple */
429+
bits8*bp=td->t_bits;/* ptr to null bitmap in tuple */
430430
boolslow= false;/* do we have to walk attrs? */
431431
intoff;/* current offset within data */
432432

@@ -441,7 +441,7 @@ nocachegetattr(HeapTuple tuple,
441441

442442
attnum--;
443443

444-
if (!HeapTupleNoNulls(tuple))
444+
if (!HeapTupleNoNulls(tup))
445445
{
446446
/*
447447
* there's a null somewhere in the tuple
@@ -470,7 +470,7 @@ nocachegetattr(HeapTuple tuple,
470470
}
471471
}
472472

473-
tp= (char*)tup+tup->t_hoff;
473+
tp= (char*)td+td->t_hoff;
474474

475475
if (!slow)
476476
{
@@ -489,7 +489,7 @@ nocachegetattr(HeapTuple tuple,
489489
* target. If there aren't any, it's safe to cheaply initialize the
490490
* cached offsets for these attrs.
491491
*/
492-
if (HeapTupleHasVarWidth(tuple))
492+
if (HeapTupleHasVarWidth(tup))
493493
{
494494
intj;
495495

@@ -565,7 +565,7 @@ nocachegetattr(HeapTuple tuple,
565565
{
566566
Form_pg_attributeatt=TupleDescAttr(tupleDesc,i);
567567

568-
if (HeapTupleHasNulls(tuple)&&att_isnull(i,bp))
568+
if (HeapTupleHasNulls(tup)&&att_isnull(i,bp))
569569
{
570570
usecache= false;
571571
continue;/* this cannot be the target att */

‎src/backend/access/heap/heapam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static bool ConditionalMultiXactIdWait(MultiXactId multi, MultiXactStatus status
108108
staticvoidindex_delete_sort(TM_IndexDeleteOp*delstate);
109109
staticintbottomup_sort_and_shrink(TM_IndexDeleteOp*delstate);
110110
staticXLogRecPtrlog_heap_new_cid(Relationrelation,HeapTupletup);
111-
staticHeapTupleExtractReplicaIdentity(Relationrel,HeapTupletup,boolkey_required,
111+
staticHeapTupleExtractReplicaIdentity(Relationrelation,HeapTupletp,boolkey_required,
112112
bool*copy);
113113

114114

‎src/backend/access/heap/heapam_visibility.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,30 +1763,30 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
17631763
*if so, the indicated buffer is marked dirty.
17641764
*/
17651765
bool
1766-
HeapTupleSatisfiesVisibility(HeapTupletup,Snapshotsnapshot,Bufferbuffer)
1766+
HeapTupleSatisfiesVisibility(HeapTuplehtup,Snapshotsnapshot,Bufferbuffer)
17671767
{
17681768
switch (snapshot->snapshot_type)
17691769
{
17701770
caseSNAPSHOT_MVCC:
1771-
returnHeapTupleSatisfiesMVCC(tup,snapshot,buffer);
1771+
returnHeapTupleSatisfiesMVCC(htup,snapshot,buffer);
17721772
break;
17731773
caseSNAPSHOT_SELF:
1774-
returnHeapTupleSatisfiesSelf(tup,snapshot,buffer);
1774+
returnHeapTupleSatisfiesSelf(htup,snapshot,buffer);
17751775
break;
17761776
caseSNAPSHOT_ANY:
1777-
returnHeapTupleSatisfiesAny(tup,snapshot,buffer);
1777+
returnHeapTupleSatisfiesAny(htup,snapshot,buffer);
17781778
break;
17791779
caseSNAPSHOT_TOAST:
1780-
returnHeapTupleSatisfiesToast(tup,snapshot,buffer);
1780+
returnHeapTupleSatisfiesToast(htup,snapshot,buffer);
17811781
break;
17821782
caseSNAPSHOT_DIRTY:
1783-
returnHeapTupleSatisfiesDirty(tup,snapshot,buffer);
1783+
returnHeapTupleSatisfiesDirty(htup,snapshot,buffer);
17841784
break;
17851785
caseSNAPSHOT_HISTORIC_MVCC:
1786-
returnHeapTupleSatisfiesHistoricMVCC(tup,snapshot,buffer);
1786+
returnHeapTupleSatisfiesHistoricMVCC(htup,snapshot,buffer);
17871787
break;
17881788
caseSNAPSHOT_NON_VACUUMABLE:
1789-
returnHeapTupleSatisfiesNonVacuumable(tup,snapshot,buffer);
1789+
returnHeapTupleSatisfiesNonVacuumable(htup,snapshot,buffer);
17901790
break;
17911791
}
17921792

‎src/backend/access/heap/visibilitymap.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static void vm_extend(Relation rel, BlockNumber vm_nblocks);
137137
* any I/O. Returns true if any bits have been cleared and false otherwise.
138138
*/
139139
bool
140-
visibilitymap_clear(Relationrel,BlockNumberheapBlk,Bufferbuf,uint8flags)
140+
visibilitymap_clear(Relationrel,BlockNumberheapBlk,Buffervmbuf,uint8flags)
141141
{
142142
BlockNumbermapBlock=HEAPBLK_TO_MAPBLOCK(heapBlk);
143143
intmapByte=HEAPBLK_TO_MAPBYTE(heapBlk);
@@ -152,21 +152,21 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf, uint8 flags)
152152
elog(DEBUG1,"vm_clear %s %d",RelationGetRelationName(rel),heapBlk);
153153
#endif
154154

155-
if (!BufferIsValid(buf)||BufferGetBlockNumber(buf)!=mapBlock)
155+
if (!BufferIsValid(vmbuf)||BufferGetBlockNumber(vmbuf)!=mapBlock)
156156
elog(ERROR,"wrong buffer passed to visibilitymap_clear");
157157

158-
LockBuffer(buf,BUFFER_LOCK_EXCLUSIVE);
159-
map=PageGetContents(BufferGetPage(buf));
158+
LockBuffer(vmbuf,BUFFER_LOCK_EXCLUSIVE);
159+
map=PageGetContents(BufferGetPage(vmbuf));
160160

161161
if (map[mapByte]&mask)
162162
{
163163
map[mapByte] &= ~mask;
164164

165-
MarkBufferDirty(buf);
165+
MarkBufferDirty(vmbuf);
166166
cleared= true;
167167
}
168168

169-
LockBuffer(buf,BUFFER_LOCK_UNLOCK);
169+
LockBuffer(vmbuf,BUFFER_LOCK_UNLOCK);
170170

171171
returncleared;
172172
}
@@ -180,43 +180,43 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf, uint8 flags)
180180
* shouldn't hold a lock on the heap page while doing that. Then, call
181181
* visibilitymap_set to actually set the bit.
182182
*
183-
* On entry, *buf should be InvalidBuffer or a valid buffer returned by
183+
* On entry, *vmbuf should be InvalidBuffer or a valid buffer returned by
184184
* an earlier call to visibilitymap_pin or visibilitymap_get_status on the same
185-
* relation. On return, *buf is a valid buffer with the map page containing
185+
* relation. On return, *vmbuf is a valid buffer with the map page containing
186186
* the bit for heapBlk.
187187
*
188188
* If the page doesn't exist in the map file yet, it is extended.
189189
*/
190190
void
191-
visibilitymap_pin(Relationrel,BlockNumberheapBlk,Buffer*buf)
191+
visibilitymap_pin(Relationrel,BlockNumberheapBlk,Buffer*vmbuf)
192192
{
193193
BlockNumbermapBlock=HEAPBLK_TO_MAPBLOCK(heapBlk);
194194

195195
/* Reuse the old pinned buffer if possible */
196-
if (BufferIsValid(*buf))
196+
if (BufferIsValid(*vmbuf))
197197
{
198-
if (BufferGetBlockNumber(*buf)==mapBlock)
198+
if (BufferGetBlockNumber(*vmbuf)==mapBlock)
199199
return;
200200

201-
ReleaseBuffer(*buf);
201+
ReleaseBuffer(*vmbuf);
202202
}
203-
*buf=vm_readbuf(rel,mapBlock, true);
203+
*vmbuf=vm_readbuf(rel,mapBlock, true);
204204
}
205205

206206
/*
207207
*visibilitymap_pin_ok - do we already have the correct page pinned?
208208
*
209-
* On entry,buf should be InvalidBuffer or a valid buffer returned by
209+
* On entry,vmbuf should be InvalidBuffer or a valid buffer returned by
210210
* an earlier call to visibilitymap_pin or visibilitymap_get_status on the same
211211
* relation. The return value indicates whether the buffer covers the
212212
* given heapBlk.
213213
*/
214214
bool
215-
visibilitymap_pin_ok(BlockNumberheapBlk,Bufferbuf)
215+
visibilitymap_pin_ok(BlockNumberheapBlk,Buffervmbuf)
216216
{
217217
BlockNumbermapBlock=HEAPBLK_TO_MAPBLOCK(heapBlk);
218218

219-
returnBufferIsValid(buf)&&BufferGetBlockNumber(buf)==mapBlock;
219+
returnBufferIsValid(vmbuf)&&BufferGetBlockNumber(vmbuf)==mapBlock;
220220
}
221221

222222
/*
@@ -314,11 +314,11 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
314314
* Are all tuples on heapBlk visible to all or are marked frozen, according
315315
* to the visibility map?
316316
*
317-
* On entry, *buf should be InvalidBuffer or a valid buffer returned by an
317+
* On entry, *vmbuf should be InvalidBuffer or a valid buffer returned by an
318318
* earlier call to visibilitymap_pin or visibilitymap_get_status on the same
319-
* relation. On return, *buf is a valid buffer with the map page containing
319+
* relation. On return, *vmbuf is a valid buffer with the map page containing
320320
* the bit for heapBlk, or InvalidBuffer. The caller is responsible for
321-
* releasing *buf after it's done testing and setting bits.
321+
* releasing *vmbuf after it's done testing and setting bits.
322322
*
323323
* NOTE: This function is typically called without a lock on the heap page,
324324
* so somebody else could change the bit just after we look at it. In fact,
@@ -328,7 +328,7 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
328328
* all concurrency issues!
329329
*/
330330
uint8
331-
visibilitymap_get_status(Relationrel,BlockNumberheapBlk,Buffer*buf)
331+
visibilitymap_get_status(Relationrel,BlockNumberheapBlk,Buffer*vmbuf)
332332
{
333333
BlockNumbermapBlock=HEAPBLK_TO_MAPBLOCK(heapBlk);
334334
uint32mapByte=HEAPBLK_TO_MAPBYTE(heapBlk);
@@ -341,23 +341,23 @@ visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *buf)
341341
#endif
342342

343343
/* Reuse the old pinned buffer if possible */
344-
if (BufferIsValid(*buf))
344+
if (BufferIsValid(*vmbuf))
345345
{
346-
if (BufferGetBlockNumber(*buf)!=mapBlock)
346+
if (BufferGetBlockNumber(*vmbuf)!=mapBlock)
347347
{
348-
ReleaseBuffer(*buf);
349-
*buf=InvalidBuffer;
348+
ReleaseBuffer(*vmbuf);
349+
*vmbuf=InvalidBuffer;
350350
}
351351
}
352352

353-
if (!BufferIsValid(*buf))
353+
if (!BufferIsValid(*vmbuf))
354354
{
355-
*buf=vm_readbuf(rel,mapBlock, false);
356-
if (!BufferIsValid(*buf))
355+
*vmbuf=vm_readbuf(rel,mapBlock, false);
356+
if (!BufferIsValid(*vmbuf))
357357
return false;
358358
}
359359

360-
map=PageGetContents(BufferGetPage(*buf));
360+
map=PageGetContents(BufferGetPage(*vmbuf));
361361

362362
/*
363363
* A single byte read is atomic. There could be memory-ordering effects

‎src/backend/access/table/tableam.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,18 @@ table_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan,
172172
}
173173

174174
TableScanDesc
175-
table_beginscan_parallel(Relationrelation,ParallelTableScanDescparallel_scan)
175+
table_beginscan_parallel(Relationrelation,ParallelTableScanDescpscan)
176176
{
177177
Snapshotsnapshot;
178178
uint32flags=SO_TYPE_SEQSCAN |
179179
SO_ALLOW_STRAT |SO_ALLOW_SYNC |SO_ALLOW_PAGEMODE;
180180

181-
Assert(RelationGetRelid(relation)==parallel_scan->phs_relid);
181+
Assert(RelationGetRelid(relation)==pscan->phs_relid);
182182

183-
if (!parallel_scan->phs_snapshot_any)
183+
if (!pscan->phs_snapshot_any)
184184
{
185185
/* Snapshot was serialized -- restore it */
186-
snapshot=RestoreSnapshot((char*)parallel_scan+
187-
parallel_scan->phs_snapshot_off);
186+
snapshot=RestoreSnapshot((char*)pscan+pscan->phs_snapshot_off);
188187
RegisterSnapshot(snapshot);
189188
flags |=SO_TEMP_SNAPSHOT;
190189
}
@@ -195,7 +194,7 @@ table_beginscan_parallel(Relation relation, ParallelTableScanDesc parallel_scan)
195194
}
196195

197196
returnrelation->rd_tableam->scan_begin(relation,snapshot,0,NULL,
198-
parallel_scan,flags);
197+
pscan,flags);
199198
}
200199

201200

‎src/backend/access/transam/multixact.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,14 +1214,14 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
12141214
* range, that is, greater to or equal than oldestMultiXactId, and less than
12151215
* nextMXact. Otherwise, an error is raised.
12161216
*
1217-
*onlyLock must be set to true if caller is certain that the given multi
1217+
*isLockOnly must be set to true if caller is certain that the given multi
12181218
* is used only to lock tuples; can be false without loss of correctness,
12191219
* but passing a true means we can return quickly without checking for
12201220
* old updates.
12211221
*/
12221222
int
12231223
GetMultiXactIdMembers(MultiXactIdmulti,MultiXactMember**members,
1224-
boolfrom_pgupgrade,boolonlyLock)
1224+
boolfrom_pgupgrade,boolisLockOnly)
12251225
{
12261226
intpageno;
12271227
intprev_pageno;
@@ -1263,7 +1263,7 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members,
12631263
* we can skip checking if the value is older than our oldest visible
12641264
* multi. It cannot possibly still be running.
12651265
*/
1266-
if (onlyLock&&
1266+
if (isLockOnly&&
12671267
MultiXactIdPrecedes(multi,OldestVisibleMXactId[MyBackendId]))
12681268
{
12691269
debug_elog2(DEBUG2,"GetMembers: a locker-only multi is too old");

‎src/include/access/heapam.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ extern TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
118118
intnkeys,ScanKeykey,
119119
ParallelTableScanDescparallel_scan,
120120
uint32flags);
121-
externvoidheap_setscanlimits(TableScanDescscan,BlockNumberstartBlk,
121+
externvoidheap_setscanlimits(TableScanDescsscan,BlockNumberstartBlk,
122122
BlockNumbernumBlks);
123-
externvoidheapgetpage(TableScanDescscan,BlockNumberpage);
124-
externvoidheap_rescan(TableScanDescscan,ScanKeykey,boolset_params,
123+
externvoidheapgetpage(TableScanDescsscan,BlockNumberpage);
124+
externvoidheap_rescan(TableScanDescsscan,ScanKeykey,boolset_params,
125125
boolallow_strat,boolallow_sync,boolallow_pagemode);
126-
externvoidheap_endscan(TableScanDescscan);
127-
externHeapTupleheap_getnext(TableScanDescscan,ScanDirectiondirection);
126+
externvoidheap_endscan(TableScanDescsscan);
127+
externHeapTupleheap_getnext(TableScanDescsscan,ScanDirectiondirection);
128128
externboolheap_getnextslot(TableScanDescsscan,
129129
ScanDirectiondirection,structTupleTableSlot*slot);
130130
externvoidheap_set_tidrange(TableScanDescsscan,ItemPointermintid,
@@ -138,7 +138,7 @@ extern bool heap_hot_search_buffer(ItemPointer tid, Relation relation,
138138
Bufferbuffer,Snapshotsnapshot,HeapTupleheapTuple,
139139
bool*all_dead,boolfirst_call);
140140

141-
externvoidheap_get_latest_tid(TableScanDescscan,ItemPointertid);
141+
externvoidheap_get_latest_tid(TableScanDescsscan,ItemPointertid);
142142

143143
externBulkInsertStateGetBulkInsertState(void);
144144
externvoidFreeBulkInsertState(BulkInsertState);
@@ -160,7 +160,7 @@ extern TM_Result heap_update(Relation relation, ItemPointer otid,
160160
structTM_FailureData*tmfd,LockTupleMode*lockmode);
161161
externTM_Resultheap_lock_tuple(Relationrelation,HeapTupletuple,
162162
CommandIdcid,LockTupleModemode,LockWaitPolicywait_policy,
163-
boolfollow_update,
163+
boolfollow_updates,
164164
Buffer*buffer,structTM_FailureData*tmfd);
165165

166166
externvoidheap_inplace_update(Relationrelation,HeapTupletuple);
@@ -187,7 +187,7 @@ extern void heap_page_prune_opt(Relation relation, Buffer buffer);
187187
externintheap_page_prune(Relationrelation,Bufferbuffer,
188188
structGlobalVisState*vistest,
189189
TransactionIdold_snap_xmin,
190-
TimestampTzold_snap_ts_ts,
190+
TimestampTzold_snap_ts,
191191
int*nnewlpdead,
192192
OffsetNumber*off_loc);
193193
externvoidheap_page_prune_execute(Bufferbuffer,
@@ -202,13 +202,13 @@ extern void heap_vacuum_rel(Relation rel,
202202
structVacuumParams*params,BufferAccessStrategybstrategy);
203203

204204
/* in heap/heapam_visibility.c */
205-
externboolHeapTupleSatisfiesVisibility(HeapTuplestup,Snapshotsnapshot,
205+
externboolHeapTupleSatisfiesVisibility(HeapTuplehtup,Snapshotsnapshot,
206206
Bufferbuffer);
207-
externTM_ResultHeapTupleSatisfiesUpdate(HeapTuplestup,CommandIdcurcid,
207+
externTM_ResultHeapTupleSatisfiesUpdate(HeapTuplehtup,CommandIdcurcid,
208208
Bufferbuffer);
209-
externHTSV_ResultHeapTupleSatisfiesVacuum(HeapTuplestup,TransactionIdOldestXmin,
209+
externHTSV_ResultHeapTupleSatisfiesVacuum(HeapTuplehtup,TransactionIdOldestXmin,
210210
Bufferbuffer);
211-
externHTSV_ResultHeapTupleSatisfiesVacuumHorizon(HeapTuplestup,Bufferbuffer,
211+
externHTSV_ResultHeapTupleSatisfiesVacuumHorizon(HeapTuplehtup,Bufferbuffer,
212212
TransactionId*dead_after);
213213
externvoidHeapTupleSetHintBits(HeapTupleHeadertuple,Bufferbuffer,
214214
uint16infomask,TransactionIdxid);
@@ -227,7 +227,7 @@ extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data,
227227
HeapTuplehtup,
228228
Bufferbuffer,
229229
CommandId*cmin,CommandId*cmax);
230-
externvoidHeapCheckForSerializableConflictOut(boolvalid,Relationrelation,HeapTupletuple,
230+
externvoidHeapCheckForSerializableConflictOut(boolvisible,Relationrelation,HeapTupletuple,
231231
Bufferbuffer,Snapshotsnapshot);
232232

233233
#endif/* HEAPAM_H */

‎src/include/access/heapam_xlog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ extern bool heap_prepare_freeze_tuple(HeapTupleHeader tuple,
414414
TransactionId*relfrozenxid_out,
415415
MultiXactId*relminmxid_out);
416416
externvoidheap_execute_freeze_tuple(HeapTupleHeadertuple,
417-
xl_heap_freeze_tuple*xlrec_tp);
417+
xl_heap_freeze_tuple*frz);
418418
externXLogRecPtrlog_heap_visible(RelFileLocatorrlocator,Bufferheap_buffer,
419-
Buffervm_buffer,TransactionIdcutoff_xid,uint8flags);
419+
Buffervm_buffer,TransactionIdcutoff_xid,uint8vmflags);
420420

421421
#endif/* HEAPAM_XLOG_H */

‎src/include/access/htup_details.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ extern void heap_fill_tuple(TupleDesc tupleDesc,
699699
uint16*infomask,bits8*bit);
700700
externboolheap_attisnull(HeapTupletup,intattnum,TupleDesctupleDesc);
701701
externDatumnocachegetattr(HeapTupletup,intattnum,
702-
TupleDescatt);
702+
TupleDesctupleDesc);
703703
externDatumheap_getsysattr(HeapTupletup,intattnum,TupleDesctupleDesc,
704704
bool*isnull);
705705
externDatumgetmissingattr(TupleDesctupleDesc,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp