Skip to content

Commit 09c5ace

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 me Discussion: http://postgr.es/m/[email protected]
1 parent 5ca0fe5 commit 09c5ace

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
typedef struct SMgrSortArray
@@ -483,10 +483,10 @@ static BufferDesc *BufferAlloc(SMgrRelation smgr,
483483
BufferAccessStrategy strategy,
484484
bool *foundPtr);
485485
static void FlushBuffer(BufferDesc *buf, SMgrRelation reln);
486-
static void FindAndDropRelFileLocatorBuffers(RelFileLocator rlocator,
487-
ForkNumber forkNum,
488-
BlockNumber nForkBlock,
489-
BlockNumber firstDelBlock);
486+
static void FindAndDropRelationBuffers(RelFileLocator rlocator,
487+
ForkNumber forkNum,
488+
BlockNumber nForkBlock,
489+
BlockNumber firstDelBlock);
490490
static void RelationCopyStorageUsingBuffer(Relation src, Relation dst,
491491
ForkNumber forkNum,
492492
bool isunlogged);
@@ -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(SMgrRelation smgr_reln, ForkNumber *forkNum,
3051-
int nforks, BlockNumber *firstDelBlock)
3050+
DropRelationBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
3051+
int nforks, BlockNumber *firstDelBlock)
30523052
{
30533053
int i;
30543054
int j;
@@ -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, int nlocators)
3173+
DropRelationsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
31753174
{
31763175
int i;
31773176
int j;
@@ -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. See DropRelFileLocatorBuffers.
3221+
* of each of the given relation forks. See DropRelationBuffers.
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
uint32 buf_state;
32923291

32933292
/*
3294-
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
3293+
* As in DropRelationBuffers, 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
static void
3343-
FindAndDropRelFileLocatorBuffers(RelFileLocator rlocator, ForkNumber forkNum,
3344-
BlockNumber nForkBlock,
3345-
BlockNumber firstDelBlock)
3342+
FindAndDropRelationBuffers(RelFileLocator rlocator, ForkNumber forkNum,
3343+
BlockNumber nForkBlock,
3344+
BlockNumber firstDelBlock)
33463345
{
33473346
BlockNumber curBlock;
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
uint32 buf_state;
34173416

34183417
/*
3419-
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
3418+
* As in DropRelationBuffers, 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 in DropRelFileLocatorBuffers, an unlocked precheck should be
3563+
* As in DropRelationBuffers, 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
uint32 buf_state;
36353634

36363635
/*
3637-
* As in DropRelFileLocatorBuffers, an unlocked precheck should be
3636+
* As in DropRelationBuffers, 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 in DropRelFileLocatorBuffers, an unlocked precheck should be
3866+
* As in DropRelationBuffers, 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-
* See DropRelFileLocatorBuffers in bufmgr.c for more notes.
323+
* See DropRelationBuffers in bufmgr.c for more notes.
324324
*/
325325
void
326-
DropRelFileLocatorLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
327-
BlockNumber firstDelBlock)
326+
DropRelationLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
327+
BlockNumber firstDelBlock)
328328
{
329329
int i;
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-
* See DropRelFileLocatorsAllBuffers in bufmgr.c for more notes.
370+
* See DropRelationsAllBuffers in bufmgr.c for more notes.
371371
*/
372372
void
373-
DropRelFileLocatorAllLocalBuffers(RelFileLocator rlocator)
373+
DropRelationAllLocalBuffers(RelFileLocator rlocator)
374374
{
375375
int i;
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 in DropRelFileLocatorBuffers while
592+
* aren't enabled, we'll fail later in DropRelationBuffers 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
extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum,
338338
BlockNumber blockNum, bool *foundPtr);
339339
extern void MarkLocalBufferDirty(Buffer buffer);
340-
extern void DropRelFileLocatorLocalBuffers(RelFileLocator rlocator, ForkNumber forkNum,
341-
BlockNumber firstDelBlock);
342-
extern void DropRelFileLocatorAllLocalBuffers(RelFileLocator rlocator);
340+
extern void DropRelationLocalBuffers(RelFileLocator rlocator,
341+
ForkNumber forkNum,
342+
BlockNumber firstDelBlock);
343+
extern void DropRelationAllLocalBuffers(RelFileLocator rlocator);
343344
extern void AtEOXact_LocalBuffers(bool isCommit);
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
RelFileLocator dst_rlocator,
209209
bool permanent);
210210
extern void FlushDatabaseBuffers(Oid dbid);
211-
extern void DropRelFileLocatorBuffers(struct SMgrRelationData *smgr_reln,
212-
ForkNumber *forkNum,
213-
int nforks, BlockNumber *firstDelBlock);
214-
extern void DropRelFileLocatorsAllBuffers(struct SMgrRelationData **smgr_reln,
215-
int nlocators);
211+
extern void DropRelationBuffers(struct SMgrRelationData *smgr_reln,
212+
ForkNumber *forkNum,
213+
int nforks, BlockNumber *firstDelBlock);
214+
extern void DropRelationsAllBuffers(struct SMgrRelationData **smgr_reln,
215+
int nlocators);
216216
extern void DropDatabaseBuffers(Oid dbid);
217217

218218
#define RelationGetNumberOfBlocks(reln) \

0 commit comments

Comments
 (0)