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

Commit09c5ace

Browse files
committed
Rename some functions to mention Relation instead of RelFileLocator.
This is definitely shorter, and hopefully clearer.Kyotaro Horiguchi, reviewed by Dilip Kumar and by meDiscussion:http://postgr.es/m/20220707.174436.1885393789789795413.horikyota.ntt@gmail.com
1 parent5ca0fe5 commit09c5ace

File tree

5 files changed

+50
-50
lines changed

5 files changed

+50
-50
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ typedef struct CkptTsStatus
121121
* Type for array used to sort SMgrRelations
122122
*
123123
* FlushRelationsAllBuffers shares the same comparator function with
124-
*DropRelFileLocatorsAllBuffers. Pointer to this struct and RelFileLocator must be
124+
*DropRelationsAllBuffers. Pointer to this struct and RelFileLocator must be
125125
* compatible.
126126
*/
127127
typedefstructSMgrSortArray
@@ -483,10 +483,10 @@ static BufferDesc *BufferAlloc(SMgrRelation smgr,
483483
BufferAccessStrategystrategy,
484484
bool*foundPtr);
485485
staticvoidFlushBuffer(BufferDesc*buf,SMgrRelationreln);
486-
staticvoidFindAndDropRelFileLocatorBuffers(RelFileLocatorrlocator,
487-
ForkNumberforkNum,
488-
BlockNumbernForkBlock,
489-
BlockNumberfirstDelBlock);
486+
staticvoidFindAndDropRelationBuffers(RelFileLocatorrlocator,
487+
ForkNumberforkNum,
488+
BlockNumbernForkBlock,
489+
BlockNumberfirstDelBlock);
490490
staticvoidRelationCopyStorageUsingBuffer(Relationsrc,Relationdst,
491491
ForkNumberforkNum,
492492
boolisunlogged);
@@ -3026,7 +3026,7 @@ BufferGetLSNAtomic(Buffer buffer)
30263026
}
30273027

30283028
/* ---------------------------------------------------------------------
3029-
*DropRelFileLocatorBuffers
3029+
*DropRelationBuffers
30303030
*
30313031
*This function removes from the buffer pool all the pages of the
30323032
*specified relation forks that have block numbers >= firstDelBlock.
@@ -3047,8 +3047,8 @@ BufferGetLSNAtomic(Buffer buffer)
30473047
* --------------------------------------------------------------------
30483048
*/
30493049
void
3050-
DropRelFileLocatorBuffers(SMgrRelationsmgr_reln,ForkNumber*forkNum,
3051-
intnforks,BlockNumber*firstDelBlock)
3050+
DropRelationBuffers(SMgrRelationsmgr_reln,ForkNumber*forkNum,
3051+
intnforks,BlockNumber*firstDelBlock)
30523052
{
30533053
inti;
30543054
intj;
@@ -3064,8 +3064,8 @@ DropRelFileLocatorBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
30643064
if (rlocator.backend==MyBackendId)
30653065
{
30663066
for (j=0;j<nforks;j++)
3067-
DropRelFileLocatorLocalBuffers(rlocator.locator,forkNum[j],
3068-
firstDelBlock[j]);
3067+
DropRelationLocalBuffers(rlocator.locator,forkNum[j],
3068+
firstDelBlock[j]);
30693069
}
30703070
return;
30713071
}
@@ -3115,8 +3115,8 @@ DropRelFileLocatorBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
31153115
nBlocksToInvalidate<BUF_DROP_FULL_SCAN_THRESHOLD)
31163116
{
31173117
for (j=0;j<nforks;j++)
3118-
FindAndDropRelFileLocatorBuffers(rlocator.locator,forkNum[j],
3119-
nForkBlock[j],firstDelBlock[j]);
3118+
FindAndDropRelationBuffers(rlocator.locator,forkNum[j],
3119+
nForkBlock[j],firstDelBlock[j]);
31203120
return;
31213121
}
31223122

@@ -3162,16 +3162,15 @@ DropRelFileLocatorBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
31623162
}
31633163

31643164
/* ---------------------------------------------------------------------
3165-
*DropRelFileLocatorsAllBuffers
3165+
*DropRelationsAllBuffers
31663166
*
31673167
*This function removes from the buffer pool all the pages of all
31683168
*forks of the specified relations. It's equivalent to calling
3169-
*DropRelFileLocatorBuffers once per fork per relation with
3170-
*firstDelBlock = 0.
3171-
* --------------------------------------------------------------------
3169+
*DropRelationBuffers once per fork per relation with firstDelBlock = 0.
3170+
*--------------------------------------------------------------------
31723171
*/
31733172
void
3174-
DropRelFileLocatorsAllBuffers(SMgrRelation*smgr_reln,intnlocators)
3173+
DropRelationsAllBuffers(SMgrRelation*smgr_reln,intnlocators)
31753174
{
31763175
inti;
31773176
intj;
@@ -3194,7 +3193,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
31943193
if (RelFileLocatorBackendIsTemp(smgr_reln[i]->smgr_rlocator))
31953194
{
31963195
if (smgr_reln[i]->smgr_rlocator.backend==MyBackendId)
3197-
DropRelFileLocatorAllLocalBuffers(smgr_reln[i]->smgr_rlocator.locator);
3196+
DropRelationAllLocalBuffers(smgr_reln[i]->smgr_rlocator.locator);
31983197
}
31993198
else
32003199
rels[n++]=smgr_reln[i];
@@ -3219,7 +3218,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
32193218

32203219
/*
32213220
* We can avoid scanning the entire buffer pool if we know the exact size
3222-
* of each of the given relation forks. SeeDropRelFileLocatorBuffers.
3221+
* of each of the given relation forks. SeeDropRelationBuffers.
32233222
*/
32243223
for (i=0;i<n&&cached;i++)
32253224
{
@@ -3257,8 +3256,8 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
32573256
continue;
32583257

32593258
/* drop all the buffers for a particular relation fork */
3260-
FindAndDropRelFileLocatorBuffers(rels[i]->smgr_rlocator.locator,
3261-
j,block[i][j],0);
3259+
FindAndDropRelationBuffers(rels[i]->smgr_rlocator.locator,
3260+
j,block[i][j],0);
32623261
}
32633262
}
32643263

@@ -3291,7 +3290,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
32913290
uint32buf_state;
32923291

32933292
/*
3294-
* As inDropRelFileLocatorBuffers, an unlocked precheck should be
3293+
* As inDropRelationBuffers, an unlocked precheck should be
32953294
* safe and saves some cycles.
32963295
*/
32973296

@@ -3331,7 +3330,7 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
33313330
}
33323331

33333332
/* ---------------------------------------------------------------------
3334-
*FindAndDropRelFileLocatorBuffers
3333+
*FindAndDropRelationBuffers
33353334
*
33363335
*This function performs look up in BufMapping table and removes from the
33373336
*buffer pool all the pages of the specified relation fork that has block
@@ -3340,9 +3339,9 @@ DropRelFileLocatorsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
33403339
* --------------------------------------------------------------------
33413340
*/
33423341
staticvoid
3343-
FindAndDropRelFileLocatorBuffers(RelFileLocatorrlocator,ForkNumberforkNum,
3344-
BlockNumbernForkBlock,
3345-
BlockNumberfirstDelBlock)
3342+
FindAndDropRelationBuffers(RelFileLocatorrlocator,ForkNumberforkNum,
3343+
BlockNumbernForkBlock,
3344+
BlockNumberfirstDelBlock)
33463345
{
33473346
BlockNumbercurBlock;
33483347

@@ -3397,7 +3396,7 @@ FindAndDropRelFileLocatorBuffers(RelFileLocator rlocator, ForkNumber forkNum,
33973396
*bothering to write them out first. This is used when we destroy a
33983397
*database, to avoid trying to flush data to disk when the directory
33993398
*tree no longer exists. Implementation is pretty similar to
3400-
*DropRelFileLocatorBuffers() which is for destroying just one relation.
3399+
*DropRelationBuffers() which is for destroying just one relation.
34013400
* --------------------------------------------------------------------
34023401
*/
34033402
void
@@ -3416,7 +3415,7 @@ DropDatabaseBuffers(Oid dbid)
34163415
uint32buf_state;
34173416

34183417
/*
3419-
* As inDropRelFileLocatorBuffers, an unlocked precheck should be
3418+
* As inDropRelationBuffers, an unlocked precheck should be
34203419
* safe and saves some cycles.
34213420
*/
34223421
if (bufHdr->tag.rlocator.dbOid!=dbid)
@@ -3561,7 +3560,7 @@ FlushRelationBuffers(Relation rel)
35613560
bufHdr=GetBufferDescriptor(i);
35623561

35633562
/*
3564-
* As inDropRelFileLocatorBuffers, an unlocked precheck should be
3563+
* As inDropRelationBuffers, an unlocked precheck should be
35653564
* safe and saves some cycles.
35663565
*/
35673566
if (!RelFileLocatorEquals(bufHdr->tag.rlocator,rel->rd_locator))
@@ -3616,7 +3615,7 @@ FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels)
36163615

36173616
/*
36183617
* Save the bsearch overhead for low number of relations to sync. See
3619-
*DropRelFileLocatorsAllBuffers for details.
3618+
*DropRelationsAllBuffers for details.
36203619
*/
36213620
use_bsearch=nrels>RELS_BSEARCH_THRESHOLD;
36223621

@@ -3634,7 +3633,7 @@ FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels)
36343633
uint32buf_state;
36353634

36363635
/*
3637-
* As inDropRelFileLocatorBuffers, an unlocked precheck should be
3636+
* As inDropRelationBuffers, an unlocked precheck should be
36383637
* safe and saves some cycles.
36393638
*/
36403639

@@ -3864,7 +3863,7 @@ FlushDatabaseBuffers(Oid dbid)
38643863
bufHdr=GetBufferDescriptor(i);
38653864

38663865
/*
3867-
* As inDropRelFileLocatorBuffers, an unlocked precheck should be
3866+
* As inDropRelationBuffers, an unlocked precheck should be
38683867
* safe and saves some cycles.
38693868
*/
38703869
if (bufHdr->tag.rlocator.dbOid!=dbid)

‎src/backend/storage/buffer/localbuf.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,19 @@ MarkLocalBufferDirty(Buffer buffer)
312312
}
313313

314314
/*
315-
*DropRelFileLocatorLocalBuffers
315+
*DropRelationLocalBuffers
316316
*This function removes from the buffer pool all the pages of the
317317
*specified relation that have block numbers >= firstDelBlock.
318318
*(In particular, with firstDelBlock = 0, all pages are removed.)
319319
*Dirty pages are simply dropped, without bothering to write them
320320
*out first. Therefore, this is NOT rollback-able, and so should be
321321
*used only with extreme caution!
322322
*
323-
*SeeDropRelFileLocatorBuffers in bufmgr.c for more notes.
323+
*SeeDropRelationBuffers in bufmgr.c for more notes.
324324
*/
325325
void
326-
DropRelFileLocatorLocalBuffers(RelFileLocatorrlocator,ForkNumberforkNum,
327-
BlockNumberfirstDelBlock)
326+
DropRelationLocalBuffers(RelFileLocatorrlocator,ForkNumberforkNum,
327+
BlockNumberfirstDelBlock)
328328
{
329329
inti;
330330

@@ -363,14 +363,14 @@ DropRelFileLocatorLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
363363
}
364364

365365
/*
366-
*DropRelFileLocatorAllLocalBuffers
366+
*DropRelationAllLocalBuffers
367367
*This function removes from the buffer pool all pages of all forks
368368
*of the specified relation.
369369
*
370-
*SeeDropRelFileLocatorsAllBuffers in bufmgr.c for more notes.
370+
*SeeDropRelationsAllBuffers in bufmgr.c for more notes.
371371
*/
372372
void
373-
DropRelFileLocatorAllLocalBuffers(RelFileLocatorrlocator)
373+
DropRelationAllLocalBuffers(RelFileLocatorrlocator)
374374
{
375375
inti;
376376

@@ -589,7 +589,7 @@ AtProcExit_LocalBuffers(void)
589589
{
590590
/*
591591
* We shouldn't be holding any remaining pins; if we are, and assertions
592-
* aren't enabled, we'll fail later inDropRelFileLocatorBuffers while
592+
* aren't enabled, we'll fail later inDropRelationBuffers while
593593
* trying to drop the temp rels.
594594
*/
595595
CheckForLocalBufferLeaks();

‎src/backend/storage/smgr/smgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
430430
* Get rid of any remaining buffers for the relations. bufmgr will just
431431
* drop them without bothering to write the contents.
432432
*/
433-
DropRelFileLocatorsAllBuffers(rels,nrels);
433+
DropRelationsAllBuffers(rels,nrels);
434434

435435
/*
436436
* create an array which contains all relations to be dropped, and close
@@ -631,7 +631,7 @@ smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks, BlockNumber *nb
631631
* Get rid of any buffers for the about-to-be-deleted blocks. bufmgr will
632632
* just drop them without bothering to write the contents.
633633
*/
634-
DropRelFileLocatorBuffers(reln,forknum,nforks,nblocks);
634+
DropRelationBuffers(reln,forknum,nforks,nblocks);
635635

636636
/*
637637
* Send a shared-inval message to force other backends to close any smgr

‎src/include/storage/buf_internals.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,10 @@ extern PrefetchBufferResult PrefetchLocalBuffer(SMgrRelation smgr,
337337
externBufferDesc*LocalBufferAlloc(SMgrRelationsmgr,ForkNumberforkNum,
338338
BlockNumberblockNum,bool*foundPtr);
339339
externvoidMarkLocalBufferDirty(Bufferbuffer);
340-
externvoidDropRelFileLocatorLocalBuffers(RelFileLocatorrlocator,ForkNumberforkNum,
341-
BlockNumberfirstDelBlock);
342-
externvoidDropRelFileLocatorAllLocalBuffers(RelFileLocatorrlocator);
340+
externvoidDropRelationLocalBuffers(RelFileLocatorrlocator,
341+
ForkNumberforkNum,
342+
BlockNumberfirstDelBlock);
343+
externvoidDropRelationAllLocalBuffers(RelFileLocatorrlocator);
343344
externvoidAtEOXact_LocalBuffers(boolisCommit);
344345

345346
#endif/* BUFMGR_INTERNALS_H */

‎src/include/storage/bufmgr.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ extern void CreateAndCopyRelationData(RelFileLocator src_rlocator,
208208
RelFileLocatordst_rlocator,
209209
boolpermanent);
210210
externvoidFlushDatabaseBuffers(Oiddbid);
211-
externvoidDropRelFileLocatorBuffers(structSMgrRelationData*smgr_reln,
212-
ForkNumber*forkNum,
213-
intnforks,BlockNumber*firstDelBlock);
214-
externvoidDropRelFileLocatorsAllBuffers(structSMgrRelationData**smgr_reln,
215-
intnlocators);
211+
externvoidDropRelationBuffers(structSMgrRelationData*smgr_reln,
212+
ForkNumber*forkNum,
213+
intnforks,BlockNumber*firstDelBlock);
214+
externvoidDropRelationsAllBuffers(structSMgrRelationData**smgr_reln,
215+
intnlocators);
216216
externvoidDropDatabaseBuffers(Oiddbid);
217217

218218
#defineRelationGetNumberOfBlocks(reln) \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp